Hi,
I am using v3.0 Pro Edition. I am upgrading from v2.1 to v3.0
var grid = SetupMyGrid({
id: 'campaign-list',
setHeader: 'Subscribed,Campaign,Date Added,Starts,Ends',
setInitWidths: '100,*,160,100,100',
setColAlign: 'center,left,left,left,left',
enableResizing: 'false,false,false,false,false',
setColTypes: 'ch,ro,ro,ro,ro',
setEditable: true,
data: <?php echo json_encode(array('rows' => $json_campaigns)) ?>
});
grid.attachEvent("onCheck", function(rowId,cellInd){
console.log('checkbox on click detected');
var cell = this.cells(rowId, cellInd);
});
I can not un-check a checkbox. It seems like the grid is not editable.
same grid, use different way to draw the grid
var data = <?php echo json_encode(array('rows' => $json_campaigns)) ?>;
var grid = new dhtmlXGridObject('campaign-list');
grid.setHeader('Subscribed,Campaign,Date Added,Starts,Ends');
grid.setInitWidths('100,*,160,100,100');
grid.setColAlign('center,left,left,left,left');
grid.enableResizing('false,false,false,false,false');
grid.setColTypes('ch,ro,ro,ro,ro');
grid.init();
grid.parse(data,"json");
grid.setEditable(true);
I also test with
grid.setColTypes('ch,txt,txt,txt,txt');
Till, I am unable to edit any cells. any idea what’s happening ?
Another update:
Current code base does not use data processor to update . Instead, it depends on [onCheck] event
grid.attachEvent("onCheck", function(rowId,cellInd){
var cell = this.cells(rowId, cellInd);
var url = 'marketing/ajax_campaign_set_subscribed?subscription='+rowId+'&subscribed='+cell.getValue();
new Ajax(url, { method:'get', update:messages', evalScripts:true }).request();
});
Is it the reason I can not edit cell in my grid ?
So , i think i find out the answer.
var js={
rows:[
{ id:1001, [b]locked:"0"[/b],
data:[
"100",
"A Time to Kill",
"John Grisham",
"12.99",
"1",
"05/01/1998"] },
{ id:1002,[b]locked:"1"[/b],
data:[
"1000",
"Blood and Smoke",
"Stephen King",
"0",
"1",
"01/01/2000"] }
]}
my json response has [locked:“1”] in it. It causes the grid to be non-editable. I dont know if it is a keyword or something magic. Remove the “locked” fixes my problem