This is a migrated thread and some comments may be shown as answers.

[Solved] Update grid data from tree drag/drop on client

2 Answers 167 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ralph Burleson
Top achievements
Rank 1
Ralph Burleson asked on 01 Dec 2009, 11:43 PM
Hello,

I'm trying to create a drag / drop action that moves a string of text from a tree control to a radgrid.   The value from the tree control needs to be placed into a field in the datagrid, while the datagrid is in insert or edit mode.

I'm hoping for a simple client side solution.  I don't want to commit the row to the database especially in the event the user is not ready to save it yet.

I have hold of my tree value in a variable in javascript
    
            args.get_sourceNode().get_value()

I also have a hold of the control i want to update 

            var row = selectedRows[i];
            var cell = MasterTable.getCellByColumnUniqueName(row, "PageLink");
            alert(cell.innerHTML);

I just need the magic that will help me push the value into the cell.

Any ideas a MUCH appreciated.

Ralph


2 Answers, 1 is accepted

Sort by
0
Ralph Burleson
Top achievements
Rank 1
answered on 02 Dec 2009, 07:08 PM
For clarification...   I can update the value of the control on the grid line.   I need to update the value of the control on the automatically generated edit / insert page.

 
0
Sebastian
Telerik team
answered on 04 Dec 2009, 08:32 AM
Hi Ralph,

I already answered your questions in the support ticket you opened with regards to this subject. I am posting my reply in this forum thread for reference:

To get access to the editor in the PageLink column cell (when item is in edit mode), consider accessing the childNodes[0] DOM element in the cell. It eventually would be the respective textbox editor, hence your code can be modified as follows:

           var row = selectedRows[i];
           var cell = MasterTable.getCellByColumnUniqueName(row, "PageLink");
           var cellEditor = cell.childNodes[0]; 
           cellEditor.value = "YourDraggedTreeViewNodeText";

For the insert mode the case would be different since there is no direct access to the insert form using the client API of the grid. To  reach the respective column editor, you will need to obtain reference to the thead tag and locate it there (see the sample project from
this code library thread for directions).

Keep in mind that the text you paste in the grid column editors in this way would be lost on postback or rebind operation unless you update the grid source accordingly.


Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Ralph Burleson
Top achievements
Rank 1
Answers by
Ralph Burleson
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or