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
editGridRow throws 'value is null' error
21/10/2009
15:20
Avatar
alanhumphrey
New Member
Members
Forum Posts: 2
Member Since:
21/10/2009
sp_UserOfflineSmall Offline

I have the following definition for my grid (great tool btw!).  The editGridRow function worked fine when I had a datatype of 'local' and added the data to the grid manually.  I changed the datatype to a function and while the grid loads correctly and the onSelectRow function is called, editGridRow just shows 'value is null' in firebug.  I appear to be missing something, but I can't figure out what.  Any ideas?

Thank you!

- Alan

$("#surveysite_list").jqGrid({

    datatype: function(postdata){
                  $.ajax ({
                        url: '<% $c->uri_for('list_data') %>',
                        data:postdata,
                        dataType: 'json',
                        complete: function(response, status) {
                            if (status == 'success'){
                                var grid = $("#surveysite_list")[0];
                                var o = eval ( '(' + response.responseText + ')' );
                                grid.addJSONData(o.data);
                            }
                        }
                  })
              },
    height: 450,
    colNames:[ 'Site Code', 'Name', 'County', 'Location', 'Position', 'Elevation', 'Comments', 'Active', 'site_id'],
    colModel:[ {name:'site_code',index:'site_code', width:100, editable: true, editrules:{required:true}, editoptions:{ size:15}, align:'center', sorttype:'integer' },
               {name:'site_name',index:'site_name', width:190, editable: true, editrules:{required:true}, editoptions:{ size:20} },
               {name:'county',index:'county', width:150, editable: true, editoptions:{ size:20} },
               {name:'location',index:'location', width:190, editable: true, editoptions:{ size:20} },
               {name:'position',index:'position', width:200, editable: true, editrules:{required:true}, editoptions:{ size:20} },
               {name:'elevation',index:'elevation', width:120, editable:true, hidden:true, editrules:{edithidden: true}, editoptions:{ size:20}},
               {name:'comments',index:'comments', width:40, editable: true, hidden: true, edittype:'textarea', editrules:{edithidden: true}, editoptions:{rows:5, cols:30} },
               {name:'active',index:'active', width:60, editable: true, edittype:'checkbox', editoptions:{value:"Yes:No", size:2}},
               {name:'site_id',index:'site_id', hidden:true, editable:true }
                ],
     sortname: 'site_code',
     sortorder: 'asc',
     multiselect: false,
     autowidth: true,
     onSelectRow: function(id) {
                      var row = $("#surveysite_list").getGridParam('selrow');
                      if ( row != null ) {
                         $("#surveysite_list").editGridRow( row, {editCaption:'Edit Survey Site Information',
                                                                navkeys: [true, 38, 40],
                                                                reloadAfterSubmit: true,
                                                                closeAfterEdit: false,
                                                                closeOnEscape: true,
                                                                afterSubmit: function(response, postdata) {
                                                                                 if (response.responseText.length > 2){
                                                                                     var problems = eval( '(' + response.responseText + ')' );
                                                                                     var message = '';
                                                                                     for ( var field in problems.errors) {
                                                                                         message += field + ": " + problems.errors[field] + "<br/>";
                                                                                         }
                                                                                     return [false, message, ""];
                                                                                 } else {
                                                                                     return [true, ""];
                                                                                 }
                                                                             }
                                                        });
                      }
                   },
     editurl: '<% $c->uri_for("update") %>',
     pager: "#pager",
     caption: "Survey Sites" }).navGrid("#pager",{edit:false, add:true, del:false, search:false});

23/10/2009
11:49
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Do you have set id's ? Also look in FireBug if you have attached correct id of every row.

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.

28/10/2009
20:27
Avatar
alanhumphrey
New Member
Members
Forum Posts: 2
Member Since:
21/10/2009
sp_UserOfflineSmall Offline

Found the problem.  My grid was defined for nine columns of data and I was only sending back data for eight.  Added the missing data and all is well.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
17 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