Forum

November 2nd, 2014
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
Inline Editing row saving not working for me
26/07/2009
10:37
Avatar
pbnaidu
New Member
Members
Forum Posts: 2
Member Since:
26/07/2009
sp_UserOfflineSmall Offline

Hi,

I am trying to use inline editing (with clientArray setting) in jqGrid 3.4.4 (with patch as well), following is my code. However, when I try to save a row by entering "Enter" key, it doesn't call afterSave function and displays "Loading..." above grid's title bar and is stuck there.  I also see an error printed "referenceError: Can't find variable: res" on the console. I am using HTML/Javascript inside Adobe Air.

Is my code correct or am I using editRow and saveRow correctly?

Any help is greatly appreciated.

Thanks

Babu

=================== Source Code ====================

           function onEdit(rowid) {
                alert("Edit Called");;
            }

            function onSuccess(res) {
                alert("Success Called");;
            }

            function afterSave(rowid, responseText) {
                alert("After save Called");;
            }

            function onError(res, stat) {
                alert("Error Called");;
            }           

            function createCustomersGrid() {
                jQuery("#customers").jqGrid({
                    datatype: 'clientSide',
                    colNames:['Name','Address'],
                    colModel :[
                        {name:'name',index:'name', width:300, sorttype:'text', editable:true, edittype:"text", editoptions:{size:30}},
                        {name:'address',index:'address', width:300, sorttype:'text', editable:true, edittype:"text", editoptions:{size:50}}],
                    pager: jQuery('#customers_pager'),
                    rowNum:10,
                    ondblClickRow: function(id){
                        if(id && id!==customersLastSel){
                            jQuery('#customers').restoreRow(customersLastSel);
                            customersLastSel=id;
                        }
                        air.trace("The row selected is [" + id + "]");
                        jQuery('#customers').editRow(id, true, onEdit, null, "clientArray", {}, afterSave, onError);
                    },
                    viewrecords: true,
                    imgpath: 'lib/jquery/themes/basic/images',
                    caption: 'Customers'
                });

                if (!customersGridInitialized) {
                    var data = getLatestCustomers();
                    for (i = 0; i < data.length; i++)
                    {
                        var row = data[i];
                        $("#customers").addRowData(i+1, row);
                    }
                    customersGridInitialized = true;
                }           
            }

27/07/2009
04:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Thanks it is a bug:

Open grid.iniledit.js Around the line 130 replace the entry if with this

if (url == 'clientArray') {

tmp = $.extend({},tmp, tmp2);

var res = $($t).setRowData(rowid,tmp);

$($t.rows[ind]).attr("editable","0″);

for( var k=0;k<$t.p.savedRow.length;k++) {

if( $t.p.savedRow[k].id===rowid) {fr = k; break;}

}

if(fr >= 0) { $t.p.savedRow.splice(fr,1); }

if( $.isFunction(aftersavefunc) ) { aftersavefunc(rowid,res); }

….

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.

27/07/2009
04:25
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Try to edit this, but  - be a carefully with the brackets  - i.e use " instead of "

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.

27/07/2009
20:08
Avatar
pbnaidu
New Member
Members
Forum Posts: 2
Member Since:
26/07/2009
sp_UserOfflineSmall Offline

Hi,

Thanks for the suggestion. I placed the above code and had to make one more change in jquery.jqGrid.js to use full version of the inline edit js file.

It did call my save function, however now I see some weird behaviour, if I try to select/dbl click a row, it always selects first row and my onSelectRow function isn't getting the row id.

I'll debug bit more to see if it is in my code.

Thanks

Babu

28/07/2009
09:27
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Check for propper id's in the grid.

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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