Forum

July 12th, 2025
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
jqgrid editGridRow showing a blank form on edit
26/07/2011
15:05
Avatar
gratzc
New Member
Members
Forum Posts: 2
Member Since:
26/07/2011
sp_UserOfflineSmall Offline

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.

$("#questionlist").jqGrid({ url: 'remote/someurlstuff', datatype: 'json', colNames: [ 'ID', '
Edit

', '

Delete

', '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('

' + emptyText + '

'); // 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

29/07/2011
14:40
Avatar
gratzc
New Member
Members
Forum Posts: 2
Member Since:
26/07/2011
sp_UserOfflineSmall Offline

Nevermind, I figured it out.  In case anyone else has a similar issue, it was because my data from the server was returning the ID as a number, so an id of 1 became 1.0 or an id of 7654 became 7654.0, as soon as I had the server return the ID as a string it worked fine.

Curt

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
16 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information