Row change event

I want to hook on an event whenever the user changes from one row to the next (passing the old and new row ID). I noticed that the “onBeforeSelect” event comes close but this also fires when moving from one column to the next column within the same row. I tried to use:

invtgrid.attachEvent(“onBeforeSelect”, myRowChange);

function myRowChange(new_id, old_id){
if (old_id != 0 && new_id != old_id) {
var cols = invtgrid.getColumnsNum();
var changed = invtgrid.cells(old_id,cols-1).getValue();
// last (hidden) column keeps track of any column changes within the current row
// code to store the row into the database must follow
}
return true;
}

but this seem to block the row change operation (problably because of the getValue function seems to trigger an onBeforeSelect again). Is there a solution for what I want?

You may try to use
onSelectStateChanged event:
http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:event_onselectstatechanged

or onRowSelect event:
http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:event_onrowselect

I want to store the column values of the row I’m coming from. The events you mentioned don’t have a reference to the original row so I can’t get those values.

You can store the index of selected cell with this method:
http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:api_method_dhtmlxgridobject_getselectedcellindex

This is not a solution for my problem. I want to store all column values of a the current grid row whenever the user switches from one row to another. If one of the column values has changed I want to send an AJAX request to the server to save the current row column values. If the transaction has been committed I want the next row become current, if the the transaction fails I want the origin row stay current to let the user correct the wrong information entered on the grid row. Can this be achieved with the avaible events?

You can use dhtmlxDataProcessor to send Ajax request to the server side with information of changed rows. This extension has mode where data sends to the server side each time the user changes selection of the row:

dp.setUpdateMode("row");

Please find more information here docs.dhtmlx.com/doku.php?id=dhtm … cessor:toc

Thanks Olga,

I looked at the Dataprocessor but I don’t understand how it get to work properly. I’m working in a classic .ASP environment using Visual DataFlex as the middle layer which accesses the database and does all database validation actions. I’m also using asp connector 0.3.9 you send me several months ago.

I’ve aded this code to my grid object:
var dp = new dataProcessor(“processdata.asp”);
dp.init(invtgrid);

I’m not sure what code must be in processdata.asp or how I can query the info send to this page. As you can see in the attached screenshot changes are shown in the debug window, but I get an error “url.replace is not a function”. I must me missing something obvious. Can you point me into the right direction?


You can try to use dhtmlxConnector on server side. dhtmlxConnector is a set of ASP classes which helps to simplify server side operations related to dhtmlx library components (dhtmlxGrid/TreeGrid, dhtmlxTree, dhtmlxCombo). If you want to test beta version - please contact us directly at support@dhtmlx.com