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
Performing an action after an inline edit.
04/05/2013
01:08
Avatar
sepoto
Member
Members
Forum Posts: 4
Member Since:
06/02/2013
sp_UserOfflineSmall Offline

In this case I have a jqGrid with a #pager that has an edit button exposed that will allow a user to perform an inline edit. I would like to do some saving of the edited values using jQuery.data() after the save button has been clicked on the #pager. How can I accomplish this task with jqGrid?

lastSel = "";

$(function(){

var myGrid = jQuery("#list");

console.log(myGrid);

$("#list").jqGrid({

url:'php.scripts/customers.get.php',

datatype: 'xml',

mtype: 'POST',

colNames:['idcustomers','firstname', 'lastname','address1','address2','city','state','zip','phone','email','cell'],

colModel :[

{name:'idcustomers', index:'idcustomers', width:55},

{name:'firstname', index:'firstname', width:90, editable: true},

{name:'lastname', index:'lastname', width:90, editable: true},

{name:'address1', index:'address1', width:90, editable: true},

{name:'address2', index:'address2', width:90, editable: true},

{name:'city', index:'city', width:90, editable: true},

{name:'state', index:'state', width:90, editable: true},

{name:'zip', index:'zip', width:90, editable: true},

{name:'phone', index:'phone', width:90, editable: true},

{name:'email', index:'email', width:90, editable: true},

{name:'cell', index:'cell', width:90, editable: true}

],

pager: '#pager',

rowNum:20,

rowList:[20,100,300],

sortname: 'idcustomers',

sortorder: 'asc',

shrinkToFit: true,

viewrecords: true,

gridview: true,

caption: 'Customers',

width: 1400,

height: 290,

editurl: 'php.scripts/jqgrid.updaterow.php',

ajaxGridOptions: {type:"POST"},

onSelectRow: function(id){

if(id && id!==lastSel){

jQuery('#list').restoreRow(lastSel);

lastSel=id;

jQuery("#list").data('selid',lastSel);

console.log(lastSel);

console.log(jQuery("#list").data('selid'));

$.ajax({

type: "POST",

url: "php.scripts/customers.setid.php",

data: { idcustomers: jQuery("#list").data('selid') }

}).done(function( msg )

{

console.log(msg);

});

jQuery('#list').data('selid', jQuery("#list").getCell(lastSel,0));

jQuery('#list').data('firstname', jQuery("#list").getCell(lastSel,1));

jQuery('#list').data('lastname', jQuery("#list").getCell(lastSel,2));

jQuery('#list').data('address1', jQuery("#list").getCell(lastSel,3));

jQuery('#list').data('address2', jQuery("#list").getCell(lastSel,4));

jQuery('#list').data('city', jQuery("#list").getCell(lastSel,5));

jQuery('#list').data('state', jQuery("#list").getCell(lastSel,6));

jQuery('#list').data('zip', jQuery("#list").getCell(lastSel,7));

jQuery('#list').data('phone', jQuery("#list").getCell(lastSel,8));

jQuery('#list').data('email', jQuery("#list").getCell(lastSel,9));

jQuery('#list').data('cell', jQuery("#list").getCell(lastSel,10));

}

}

})

.jqGrid('navGrid','#pager',{ edit: false, add: true, search: false }, {}, {}, {}, {}, {})

.jqGrid('inlineNav',"#pager",{})

.jqGrid('navButtonAdd',"#pager",{caption:"Toggle",title:"Toggle Search Toolbar", buttonicon :'ui-icon-pin-s',

onClickButton:function(){

myGrid[0].toggleToolbar()

}

})

.jqGrid('navButtonAdd',"#pager",{caption:"Clear",title:"Clear Search",buttonicon :'ui-icon-refresh',

onClickButton:function(){

myGrid[0].clearToolbar();

jQuery('#list').data('selid', "");

jQuery('#list').data('firstname', "");

jQuery('#list').data('lastname', "");

jQuery('#list').data('address1', "");

jQuery('#list').data('address2', "");

jQuery('#list').data('city', "");

jQuery('#list').data('state', "");

jQuery('#list').data('zip', "");

jQuery('#list').data('phone', "");

jQuery('#list').data('email', "");

jQuery('#list').data('cell', "");

}

})

.jqGrid('filterToolbar');

/***********************************************************

*********************jqgrid*********************************

***********************************************************/

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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