I have a grid with the following setup. When I edit on the grid, the form doesn't come up with the data populated, but if I type in the data, the edit sends the data to the server correctly and it is updated, but the form is always blank. Also the record paging on the edit form doesn't appear to be working. I have another grid on the same page that works fine and have done this successfully many times before, but can't figure out whats going on.
', '
', 'Question' ], colModel: [ /* Column widths must total… 773 pixels to fill full body area 713 pixels to fill a accordian area 675 pixels to fill a uniform area */ {name:'id',index:'id', width:10, sorttype:'int', hidden:false}, {name:'edit', index:'edit', width:21, align:'center', sortable:false}, {name:'delete', index:'delete', width:21, align:'center', sortable:false}, {name:'question', index:'question', edittype:'text', editoptions: {size:40,maxlength:4000}, width:633, editable: true, sorttype:'string',hidden:false} ], pager: $('#questionpager'), pgbuttons: true, pginput: true, recordtext: '{0} to {1} of {2}', emptyrecords: '', emptyDataText: 'Sorry, there are no records to display.', hidegrid: false, rowNum: 10, rowList: [2,5,10,25,100], pagerpos: 'right', recordpos: 'center', sortorder: 'asc', sortname: 'ID', height: 'auto', sortorder: 'asc', viewrecords: true, caption: 'Questions', gridComplete: function () { } , loadComplete: function () { if ($('#questionlist').getGridParam('records') == 0) { // are there any records? var grid = $('#questionlist'); var emptyText = grid.getGridParam('emptyDataText'); // get the empty text var container = grid.parents('.ui-jqgrid-view'); // find the grid's container container.find('.ui-jqgrid-hdiv, .ui-jqgrid-bdiv').hide(); // hide the column headers and the cells below container.find('.no-records').hide(); container.find('.ui-jqgrid-titlebar').after('
'); // insert the empty data text } else { var grid = $('#questionlist'); var emptyText = grid.getGridParam('emptyDataText'); // get the empty text var container = grid.parents('.ui-jqgrid-view'); // find the grid's container container.find('.ui-jqgrid-hdiv, .ui-jqgrid-bdiv').show(); container.find('.no-records').hide(); } } , jsonReader: { root: 'ROWS', //our data page: 'PAGE', //current page total: 'TOTAL', //total pages records: 'RECORDS', //total record cell: '', id: '0' //will default first column as ID }});
And this for the grid edit call
//Desc: jqGrid pop up form for editing an existing answer //Param: id - this is the ID field of the row to edit function editQuestion(id){ jQuery("#questionlist").editGridRow(id, { url:'someurltoeditthedata', width:'400', reloadAfterSubmit:true, beforeShowForm: function(formid){ $(".tinfo").css('display', 'none'); }, afterSubmit: function(data) { $('#isDirty').val('true'); $(".tinfo").css('display', 'inline'); $(".tinfo").css('color', 'green'); $(".topinfo").align='center'; $(".topinfo").html("SAVED..."); return [true,'success',1]; }, recreateForm: true }); }
Thanks for any help
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top