1

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

kamaci
  • 72,915
  • 69
  • 228
  • 366
Hunt
  • 8,215
  • 28
  • 116
  • 256
  • What if you want to move to the next cell on a return, and not the next line ... i tried changing the above with idOfNextRow being the same as the current row, and focus being set to the next cell, but that doesnt seem to work ... –  Oct 12 '11 at 10:38

1 Answers1

5

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 How to disable auto update when jqGrid edited?. A simple change of the example will give you the code which you probably need.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • 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 Aug 29 '10 at 07:49
  • 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 Aug 29 '10 at 10:09
  • 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 Aug 30 '10 at 13:50
  • @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 Aug 30 '10 at 15:08
  • @Hunt: You welcome! Sometimes it's easy explain with one example what one can do as to write a long description "How to ..." :-) – Oleg Aug 30 '10 at 15:24
  • @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 Aug 30 '10 at 17:15