Forum
00:09
24/03/2010
Following the examples from the demo site I added the following methods to add and remove rows to a clientSide data grid.
jQuery('#add').click( function () {
grid.jqGrid('addRowData', dummyRow, {"alias":"New Name","field_type":"","eav":"No"});
});
jQuery('#delete').click(function () {
var a = grid.jqGrid('getGridParam','selrow');
if(a) {
grid.jqGrid('delRowData', a);
} else {
alert('Please select a row to delete.');
}
});
The problem is if I am editing a cell in the new row, but I do not save or escape from editing then after that row is deleted the entire grid becomes non-editable. The grid deifinition is very simple:
grid.jqGrid({
height: "100%",
caption: "Transfer Variables",
pager: "#gridPager",
pgbuttons: false,
pginput: false,
datatype: "local",
cellEdit: true,
cellsubmit: "clientArray",
colModel: [{
name: 'id',
label: 'Id',
index: 'id',
hidden: true
},{
name: 'alias',
label: 'Alias',
index: 'alias',
width: 130,
editable: true
},{
name: 'source_var_name',
label: 'Variable Name',
index: 'source_var_name',
width: 100,
// use shorthand alias defined above
editable: true
}, {
name: 'field_type',
label: 'Field Type',
index: 'field_type',
width: 80,
editable: true,
edittype: "select",
editoptions: {value:"Identifier:Identifier;Temporal:Temporal;Transfer:Transfer"}
}, {
name: 'eav',
label: 'EAV?',
index: 'eav',
width: 50,
editable: true,
edittype: "select",
editoptions: {value:"Yes:Yes;No:No"}
}, {
name: 'attribute_col_name',
label: 'Attribute Column',
index: 'attribute_col_name',
width: 100,
editable: true
}, {
name: 'value_col_name',
label: 'Value Column',
index: 'value_col_name',
width: 100,
editable: true
}]
});
16:23
Moderators
30/10/2007
Hello,
What is the value of the dummyRow?
Be a sure that this value is not empty or not duplicated.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
16:36
Moderators
30/10/2007
Hello,
Yes the is such way,
Set as rowid NULL - note the capital words , the the rowid will be the next record+1
Best Regsrds
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
46 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66