tags:

views:

206

answers:

1

hi,

I am using jQuery 1.4 and jqGrid 3.8 beta ,

here i have used jqgrid table in which i wanted to create interface like excel sheet / spread sheet, where number of blank rows will already be displayed and the user can enter record into table cells the why they used to enter in spread sheet.

well i have created empty editable rows by running loop of addRowData function of JQgrid. after that i made few fields editable by specifying editable:true

now the problem is when i edit something in a field and write something after that if i move on another row then old edited data on a previous row won't get store on table it gets vanish.

here, is the live example try to type in a editable field and then move to next row.

http://www.logicatrix.com/example/records.html

A: 

Your main problem is that you should change editurl: "#" to editurl: 'clientArray' (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing#saverow) if you want to use client side editing.

Moreover I recommend you remove

<script src="js/jquery.jqGrid.js" type="text/javascript"></script>

because you insert before all needed parts of jqGrid ("js/grid.base.js" and so on). You should also copy images subdirectory from the jQuery UI.Currently one recieve small errors because files like http://www.logicatrix.com/example/images/ui-bg_highlight-soft_100_eeeeee_1x100.png could not be loaded. I recommend you also use jQuery UI 1.8.4 instead of 1.8.2 till the release of jqGrid 3.8 because of some small known problems.

UPDATED: By the way a working example of client side editing you can see under http://www.ok-soft-gmbh.com/jqGrid/ClientsideEditing4.htm (use double-click and ENTER for row editing). I prepared it before for the answer http://stackoverflow.com/questions/3455920/how-to-disable-auto-update-when-jqgrid-edited/3456207#3456207. A simple change of the example will give you the code which you probably need.

Oleg
Thanks a lot for the reply , specifying clientArray will solve half of my problem but , just imagine the speread sheet/ excel file , in which if you type something in a cell then it get stored in a table ( u dont need to press enter to store values in table) while in jqgrid pressing enter will store the data into table. so i want to go to the next row when a user presses the enter and if a user types anything in cell it get stored into table straight away please.
Hunt
Sorry, but I don't understand what you want to implement. Do you want write full Excel in JavaScript? Excel has much more features. If you want select next row you can use `jQuery("#bms-record-grooms").setSelection(idOfNextRow, true)` and then `jQuery ('#' + idOfNextRow + '_name').focus()` (like `jQuery('#1_name').focus()` where "name" is name of the column which should receive the focus). But if you want do more simulation of Excel in JavaScript your program could will be very large.
Oleg
i meant to say it , i want to override the default functionality of pressing enter key , if a user type something in a cell after that if he press enters then he will move to the next row and the data in the previous row will be saved in a client table
Hunt
@Hunt: Try http://www.ok-soft-gmbh.com/jqGrid/ClientsideEditing5.htm
Oleg
@Oleg: Thanks a lot for the example , i have just replaced restoreRow with saveRow to implement what i wanted , thanks a lot for helping me out.
Hunt
@Hunt: You welcome! Sometimes it's easy explain with one example what one can do as to write a long description "How to ..." :-)
Oleg
@Oleg: sorry but i get another issue as i replaced restoreRow with saveRow. As i move to another row the data of check box is getting copied. i just want to save the data if a user type something in if a row is blank i don't want to save it (without pressing enter key)i have update the issue here http://www.logicatrix.com/example/records.html
Hunt