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
Reload grid after cell edit
17/10/2014
01:24
Avatar
sagana
Australia
Member
Members
Forum Posts: 16
Member Since:
20/08/2009
sp_UserOfflineSmall Offline

I change the value of the quantity. The underlying table is correctly changed and I can get the alert('edit done') fires. However what I want instead of that alert is for the grid to be reloaded to show the newly calculated values that are in the table. If I press the reload button at the bottom of the grid the correct new figures are shown but i would like this to happen if I click on a new line or cell in the grid. What code should I replace alert('edit done') with to achieve this please, or is there a better way to do it?

// Set some grid options
$grid->setGridOptions(array(
"rowNum"=>5,
"sortname"=>"item",
"rowList"=>array(5,30,50),
"height"=>120,
"width"=>950,
"cellEdit"=> true,
"mtype" => "POST",
"cellsubmit" => "remote",
"cellurl" => "includes/ajaxpicked.php"
));

// Enable footerdata an tell the grid to obtain it from the request
$grid->setGridOptions(array("footerrow"=>true,"userDataOnFooter"=>true));

// reload grid after successful edit
$grid->setGridEvent("afterSaveCell", "function(rowid,name,val,iRow,iCol) {alert('edit done')}");

$grid->addCol(array("name"=>"act"),"last");

// Change some property of the field(s)
$grid->setColProperty("uid", array("label"=>"ID", "width"=>25, "editable"=>false, "hidden"=>true));
$grid->setColProperty("itemcode", array("label"=>"Item Code", "width"=>60, "editable"=>false));
$grid->setColProperty("item", array("label"=>"Item", "width"=>150, "editable"=>false));
$grid->setColProperty("price", array("label"=>"Price", "width"=>80, "editable"=>false));
$grid->setColProperty("unit", array("label"=>"Unit", "width"=>50, "editable"=>false));
$grid->setColProperty("quantity", array("label"=>"Qty", "width"=>50, "editable"=>true, "editrules"=>array("number"=>true)));
$grid->setColProperty("value", array("label"=>"Value", "width"=>70, "editable"=>false, "editable"=>false, "align"=>"right", "formatter"=>"number","formatoptions"=>array("thousandsSeparator"=>",","decimalPlaces"=>2)));
$grid->setColProperty("discount", array("label"=>"Disc.", "width"=>60, "editable"=>false, "align"=>"right", "formatter"=>"number","formatoptions"=>array("thousandsSeparator"=>",","decimalPlaces"=>2)));
$grid->setColProperty("tax", array("label"=>"Tax", "width"=>50, "editable"=>false, "align"=>"right", "formatter"=>"number","formatoptions"=>array("thousandsSeparator"=>",","decimalPlaces"=>2)));
$grid->setColProperty("tot", array("label"=>"Total", "width"=>50, "editable"=>false, "align"=>"right", "formatter"=>"number","formatoptions"=>array("thousandsSeparator"=>",","decimalPlaces"=>2)));
$grid->setColProperty("pay", array("label"=>"Pay", "width"=>20, "editable"=>false, "hidden"=>true));
$grid->setColProperty("trackserial", array("label"=>"Serial", "width"=>20, "editable"=>false, "hidden"=>true));
$grid->setColProperty("ref", array("label"=>"Ref", "width"=>20, "editable"=>false, "hidden"=>true));
$grid->setColProperty("act", array("label"=>"Selection", "width"=>50, "editable"=>false));

// At end call footerData to put total label
$grid->callGridMethod('#tradlist', 'footerData', array("set",array("quantity"=>"Total:")));
// Set which parameter to be sumarized
$summaryrows = array("value"=>array("value"=>"SUM"),"tax"=>array("tax"=>"SUM"),"tot"=>array("tot"=>"SUM"));

$loadevent = <<<LOADCOMPLETE
function(rowid){
var ids = jQuery("#purchlist").getDataIDs();
for(var i=0;i<ids.length;i++){
var rowd = $("#purchlist").getRowData(ids[i]);
var cl = ids[i];
var topay = rowd.pay;
var track = rowd.trackserial;
var rf = "'"+rowd.ref+"'";
var se = "";
if (topay == 'N') {
be = '<img src="../images/close.png" title="Add to be refunded" onclick="javascript:purchdeselect('+cl+')" ></ids>';
} else {
be = '<img src="../images/accept.gif" title="De-select" onclick="javascript:purchselect('+cl+')" ></ids>';
if (track == 'Yes') {
se = '<img src="../images/barcode.png" title="Purchased serial nos." onclick="javascript:showserial('+cl+','+rf+')" ></ids>';
}
}
jQuery("#purchlist").setRowData(ids[i],{act:be+'&nbsp;&nbsp;&nbsp;'+se});
}
}
LOADCOMPLETE;

 

$grid->setGridEvent("loadComplete",$loadevent);
// Enable navigator
$grid->navigator = true;
// Disable some actions
$grid->setNavOptions('navigator', array("excel"=>true,"add"=>false,"edit"=>false,"del"=>false,"view"=>false));

// Run the script
$grid->renderGrid('#purchlist','#purchpager',true, $summaryrows, null,true,true,true);
?>

21/10/2014
18:01
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

 

Please post your question here: http://www.trirand.net

 

Regards

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.

23/10/2014
05:23
Avatar
krish
New Member
Members
Forum Posts: 2
Member Since:
23/10/2014
sp_UserOfflineSmall Offline

Hi, Tony,

In jqgrid i had edited a record on page 5 and submitted but I can't see the newly updated record and should stay on the same page.

Please help

I am using below code:  not working it stays on same current page but the record is not updated.

var currentPage = jQuery("#mygrid").getGridParam('page');
jQuery("#mygrid").jqGrid('setGridParam', {datatype: 'json'}).trigger("reloadGrid", [{page: currentPage}]);

27/10/2014
15:11
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

 

I say again - currently, please post your problem here http://www.trirand.net/forum

 

Regards

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:
43 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