I have a grid using inline edit that allows adding multiple blank rows, but this is causing some problems.
If I add two or more rows and leave some of them with errors, the other rows (saverow succeeded) turn all columns to read-only, with the exception of a select column (edittype: select) with custom formatter to return the combo box text instead of value.
Here is a sample of my code:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
<div class="sfcode"><script type="text/javascript"><br /> jQuery(document).ready(function () {<br /> jQuery('#grid').jqGrid({<br /> autowidth:true,<br /> datatype:'local',<br /> height:'100%',<br /> pager:'#pager',<br /> rowNum:10,<br /> sortname:'User',<br /> viewrecords:true,<br /> gridComplete: function() {OnGridComplete()},<br /> onSelectRow: function(rowid, status) {OnSelectRow(rowid, status)},<br /> colModel: [<br /> {<br /> name:'AlternativeIndex',<br /> hidden:true,<br /> key:true,<br /> index:'AlternativeIndex'<br /> },{<br /> name:'UserId',<br /> formatter: formatUserAsDropDown,<br /> label:'User',<br /> sortable:true,<br /> width:300,<br /> editable:true,<br /> edittype:'select',<br /> editoptions:{"value":""},<br /> index:'UserId'<br /> },{<br /> name:'Permission',<br /> formatter:'select',<br /> hidden:false,<br /> label:'Permission',<br /> sortable:true,<br /> width:170,<br /> editable:true,<br /> edittype:'select',<br /> editoptions:{"value":"R:Read;W:Write"},<br /> index:'Permission'<br /> }<br /> ]<br /> });<br /> });<br /> </script></div> |
And here is the code for the custom formatter:
|
1 2 3 |
<div class="sfcode">function formatUserAsDropDown(cellvalue, options, rowObject) {<br /> return rowObject.Username;<br /> }</div> |
This problem does not occur with Permission column.
PS: I cannot reload the grid after saverow as there maybe have some rows with errors and I have to keep them editable until the user fix these errors and click on Save button again.
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top