Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by MHW on Jan 05, 2009 21:05
open dhtmlx forum
moveRowTo

With regard to an earlier question I asked (http://www.dhtmlx.com/docs/products/kb/index.php?s=normal&q=7002), I'm now trying to put the suggested solution into practice.

Essentially, I have two gridobjects; one is acts as a pick-list/palette and the other is my target tree.  I use the dataprocessor to maintain persistence and drag and drop is working. 

Additionally, I'm trying trying to use the moveRowTo() function to automate the drag and drop (kind of like allowing the user to set/build a default or standard tree):

    asset_grid.moveRowTo(assetRowId,parentRowId,"copy","child",asset_grid,option_grid);

The problem I'm having is that while the moveRowTo() triggers my dataprocessor function:

    dp = new dataProcessor("update_option.php");

.. some of the $_GET variables aren't sent.   e.g.:

    if(isset($_GET["!nativeeditor_status"]) && $_GET["!nativeeditor_status"] == "inserted") {
     // ***** insert *****
        $action = "insert";
        $result_id = Option::append($_GET['option_id'], $_GET["gr_pid"], $source_id, $_GET['asset_name'], $_GET["level"], $_GET["unit_id"], $_GET["cleveltype"], $_SESSION['user_id']);
        . . .
In the above PHP code, 'level', 'unit_code', and 'cleveltype' are not set as a result of the moveRowTo() function, however, they are set as a result of a drag and drop. The 3 variables are userdata properties of asset_grid:

    <row id="299">
        <userdata name="unit_id">2611</userdata>
        <userdata name="level">4</userdata>
        <userdata name="cleveltype">H</userdata>
        <cell image="folder.gif"><![CDATA[Air Receiver]]></cell>
    </row>

Is there a way of settings these variables so that my dataprocessor will work?

Also, the previously provided solution stated that the newly inserted Id by using the onDrop event.  Could you please explain how?

Thanks

 

 

Answer posted by Support on Jan 09, 2009 09:28
>>the newly inserted Id by using the onDrop event. Could you please explain how
When row copied, to prevent ID dupplication it receives new ID. 
onDrag event provides ID of source row and target row
onDrop event provides ID of inserted row and target row
in case of copy operation source ID may differ from inserted ID

>>.. some of the $_GET variables aren't sent.
Which version of the grid you are using?
In latest code the both scenarios using the same code so effect must be equal.