!nativeeditor_status error

I inserted a record using dataProcesor to call my server side. After inserting in the database I give out custom xml response like this one:



{“row_id”:“Z19-4409”,“message”:“Product Code

: Z19-4409 is added successfuly”}





on my success callback handler i do the following things:

function successHandler( _xml_node )

{

var _json = _xml_node.firstChild.data;

var _response = eval(’(’+_json+’)’);

var _row_id = _response.row_id;

var _message = _response.message;



main_grid.changeRowId ( “newrowid”, _row_id );

main_grid.cells ( _row_id, action1_index ).setValue ( editLink ( _row_id ) );

main_grid.cells ( _row_id, action2_index ).setValue ( deleteLink ( _row_id ) );

data_processor.setUpdated ( _row_id, false );

setStatusMessage ( _message );





return true; // This is needed to prevent dataProcessor to keep on sending to the server



}



i need to manually change the row id with the new id since I thought dataprocessor will handle this to me even if I have my own custom response and not using your pre defined UPDATE INSERT DELETE. I also do the setUpdated (row_id, false) to make the newly inserted row to be not in BOLD FONTS, I am expecting that dataProcessor will do this.



the above code is working fine but when I try to edit the newly inserted row. dataProcessor putting “inserted” on !nativeeditor_status. Which mean that dataProcessor is not aware of the of previous inserted row so when I update it dataProcessor thought its still a new record.



BTW here’s how I added a new row:



        function doInsert ()

        {

            var _empty = [ ];

            var _new_id = ‘newrowid’;

            curr_action = ‘add’;

                                    

            main_grid.addRow ( _new_id, _empty, 0 );        

            rowEditMode ( _new_id );

            

            toggleActionLink ( curr_action );

        }



        function rowEditMode ( row_id )

        {

            editors = [ ];

            main_grid.forEachCell ( row_id, function ( cell )

                {

                 editors.push ( cell );

                 cell.edit ();

                }

            );        

        }



The question is. What API should I call to make dataProcessor aware of this newly inserted row? Why dataProcessor is not synching if I return back a custom response xml like the one I posted above. Should I use the pre defined modes in returning an xml to make the dataProcessor aware of my server side processing? Why is that when i do manually make cells in the row in edit mode I can’t select the text? I could only use backspace to delete the data instead of just highlighting the text and typing directly.

Why is that when I return false to my dataProcessor defined action it keeps on sending data to the server?

The next lines of code is incorrect

main_grid.changeRowId ( “newrowid”, _row_id );
main_grid.cells ( _row_id, action1_index ).setValue ( editLink ( _row_id ) );
main_grid.cells ( _row_id, action2_index ).setValue ( deleteLink ( _row_id ) );
data_processor.setUpdated ( _row_id, false );

You need to call setUpdated with old ID value

data_processor.setUpdated ( “newrowid”, false );
main_grid.changeRowId ( “newrowid”, _row_id );

main_grid.cells ( _row_id, action1_index ).setValue ( editLink ( _row_id ) );

main_grid.cells ( _row_id, action2_index ).setValue ( deleteLink ( _row_id ) );

>>if I have my own custom response and not using your pre defined
The change of ID occurs only for response with action=“insert”, basically component has predefined reaction on 3 known responses and will just ignore any others.

>>so when I update it dataProcessor thought its still a new record
Caused by the code mentioned above, in your current code you are calling setUpdated with new ID value, while it must be called with old ID value, changing this code, must fix issue.

>> Should I use the pre defined modes in returning an xml to make the dataProcessor aware of my server side processing?
This is common approach, when you are using custom mode grid will not react on them at all, so you will need to have custom code.

>>Why is that when i do manually make cells in the row in edit mode I can’t select the text?
If you switch the cell to edit mode by
    grid.editCell();
it will work correctly, in other case grid still block the selection for grid.
You can enable selection in grid by
    1. In dhtmlxgrid.css locate and erase all occurences of next line
        -moz-user-select:none;
    2. In grid initialization code add next command
       grid.entBox.onselectstart = function(){ return true; };

>>Why is that when I return false to my dataProcessor defined action it keeps on sending data to the server?
This problem caused by the same error with using setUpdated and new ID value