Forum



22:05

26/04/2010

Hi,
I'm really enjoying working with jqGrid and it definitely has some of the better documentation, but I'm still running into a few things I can't figure out.
I would like to be able to navigate through the records using the form to edit the rows. I found the option to checkOnUpdate and it does something, but it doesn't work as expected. Even if I don't change anything, it tells me "Data has been changed! Save changes?" I can say yes, but it still won't let me move to another row. If I choose Cancel, it closes the form. Choosing No returns me to the form I was on. I would expect No to let me move to the next row and cancel to return me the form. I wouldn't expect this cancel to close my form. (Is there some way I can change this behavior or just change the words so I can explain what will happen to my users? (I'll probably change no to "return to form" and cancel to "close form".))
But, more importantly, how can I use the checkOnUpdate and move through all of the records. I cleared out all of my custom formatters in case they were causing the issue, but it still doesn't work. I also removed the select type in case defaulting that value was causing the issue, but I still have the same problem. What am I missing? Or is this a bug?
function(){
jQuery("#eventlist").jqGrid({
url:'example.cfc?Method=getEventLines&invoiceid=29',
editurl: 'example.cfc?Method=saveEventLine&invoiceid=29',
datatype: 'json',
mtype: 'GET',
colNames:['EventLineID','Event ID', 'Facility', 'Date', 'Start Time', 'End Time', 'Cost', 'Per', 'Hours', 'Discount', 'Total'],
colModel :[
{name:'eventlineid', index:'eventlineid', sortable:false, hidden:true},
{name:'eventid', index:'eventid', width:75, sortable:false, editable:true, editoptions:{size:10, readonly: 'readonly'}, editrules: {required: true }},
{name:'facility', index:'facility', width:80, sortable:false, editable:true, editoptions:{size:10, readonly: 'readonly'}, editrules: {required: true }},
{name:'eventdate', index:'eventdate', width:90, sortable:false, editable:true, editoptions:{size:10, readonly: 'readonly'}, editrules: {required: true }},
{name:'timestarted', index:'timestarted', width:80, align:'right', sortable:false, editable:true},
{name:'timestarted', index:'timestarted', width:80, align:'right', sortable:false, editable:true},
{name:'cost', index:'cost', width:80, align:'right', sortable:false, editable:true },
{name:'costbytype',index:'costbytype', width:50, editable: true},
{name:'hours', index:'hours', width:80, align:'right', sortable:false, editable:true},
{name:'discount', index:'discount', width:80, align:'right', sortable:false, editable:true },
{name:'total', index:'total', width:150, align:'right', sortable:false, editable:true}
],
pager: '#eventpager',
pgbuttons:false,
pginput:false,
viewrecords:false,
sortable: false,
caption: 'Facility Charges',
height: "auto",
footerrow : true,
gridComplete: function(){
//Get grid total
var eventTotal = jQuery("#eventlist").jqGrid('getCol', 'total', false, 'sum');
eventTotal = "Sub-Total " + currencyFmatter(eventTotal);
jQuery("#eventlist").jqGrid('footerData', 'set', {total:eventTotal}, false);
},
jsonReader: {
root: "ROWS", //our data
page: "PAGE", //current page
total: "TOTAL", //total pages
records:"RECORDS", //total records
cell: "", //not used
id: "0" //will default first column as ID
}
});
jQuery("#eventlist").jqGrid('navGrid',
'#eventpager',
{add:true, edit:true, del:true, search:false},
{checkOnUpdate:true,
savekey: [true,13],
navkeys: [true,38,40],
reloadAfterSubmit:false,
closeOnEscape:true,
editCaption: "Edit Facility Charge",
addCaption: "Add Facility Charge",
bottominfo:"Fields marked with (*) are required",
beforeShowForm: function() { //for later
}
}
);
});
Thanks for any insight you can provide!!
Ember
PS
Also, I would love to be able to default to the first row when the user click the edit button, but I can't figure out how to get before the check for a selected row. beforeShowForm comes after the check for a selected row. Any thoughts?
18:21

26/04/2010

Hi,
Well, I still have not found the solution to the checkOnUpdate problem. However, I did find out how to select the first row of my grid so that my users can use the edit/add/delete buttons without having to remember to click the row.
Here's the function:
var idsArray = jQuery(gridID).jqGrid('getDataIDs');
if (idsArray.length > 0) {
jQuery(gridID).jqGrid('setSelection', idsArray[0], false);
}
}
I just added a call to it in gridComplete:
function(){
jQuery("#theGridID").jqGrid({
...,
gridComplete: function(){
selectFirstRow("#theGridID");
},
...
});
});
Hope this helps someone else. If anyone has any hints about onCheckUpdate, I could still use them.
Thanks,
Ember
14:20

Moderators
30/10/2007

Hello,
Thanks
This is a bug and it is fixed in GitHub
http://github.com/tonytomov/jq.....07f02284f6
Also will be availabe in the next bugfix release which is supposed to be on May 5, 2010
Best 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.
Most Users Ever Online: 715
Currently Online:
52 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66