Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Muhv on May 14, 2009 23:55
open dhtmlx forum
Grid data update

Hi,

I have small problem. I have in grid keywords column and I change values in it by JS function, after this I want send all changed rows to server with dataprocessor.sendData(), but server doesnt get nothing from script.
Manualy changing those keywords values sends correctly all row data to server. But how can I force all changed (manually and by JS) rows to be sent to server?

Thanx.
Answer posted by dhxSupport on May 15, 2009 00:18

After changing values in the grid with JS you should manually mark that row as changed:

dp.setUpdated(rowId,state,mode) 
paramaters here are:

# rowId - id of row to set update-status for
# state - true for "updated", false for "not updated"
# mode - update mode name

Answer posted by Muhv on May 21, 2009 03:08
Thanx,

But new problem now. When I use master_checkbox to check all checkboxes on column, how can I now update info in DB, what record is checked or not???
Answer posted by Support on May 21, 2009 03:28
You can create your custom "master-checkbox-with-dataprocessor-triggering"

Add next code to the page ( this is code of original master checkbox with few modification ) 


dhtmlXGridObject.prototype._in_header_master_checkbox_dp=function(t,i,c){
    t.innerHTML=c[0]+"<input type='checkbox' />"+c[1];
    var self=this;
    t.firstChild.onclick=function(e){
        self._build_m_order();
        var j=self._m_order?self._m_order[i]:i;
        var val=this.checked?1:0;
        self.forEachRow(function(id){
            var c=this.cells(id,j);
            if (c.isCheckbox() && (c.getValue()!=val)){
                    c.setValue(val);
                   dp.setUpdated(id,true,"updated");
            }
        });
        (e||event).cancelBubble=true;
    }
}

now you can use #master_checkbox_dp in header of grid , and result control will change state of all checkboxes and trigger dataprocessor for all updated rows.