Title: Datagrid editable Post by: bakkers on March 03, 2016, 12:33:08 AM Hello
I have a datagrid with two fields, for this example lets call them A and B. Row B is always editable so i have made it this way <th data-options="field:'B',editor:'textbox'" width="100">B</th> but A should only be editable when i append a new row, so i need to change A to editable from my append function function append(){ if (endEditing()){ $('#kundeData').datagrid('appendRow',{status:'P'}); editIndex = $('#kundeData').datagrid('getRows').length-1; $('#kundeData').datagrid('selectRow', editIndex) .datagrid('beginEdit', editIndex); } } How do i do that? Regards Bakkers Title: Re: Datagrid editable Post by: stworthy on March 03, 2016, 08:19:53 AM Here is the solution to solve this question:
1. When appending a new row, set a 'isNewRow' property indicating this is a new added row. Code: $('#dg').datagrid('appendRow',{status:'P',isNewRow:true}); 2. Use the 'onBeforeEdit' event to prevent from editing the 'A' field on the old rows. Code: $('#dg').datagrid({ |