Sorry to bother you with this. Solved by using a later version (4. )
I found the demo at http://www.ok-soft-gmbh.com/jqGrid/RecreateGrid.htm
Is there a php jqgrid version of the demo that shows dynamically changing the columns in the grid?
Hi
Thanks Will. However we want to capture the error and handle it ourselves rather than show the error to the user. Is this possible and if so, how do we go about it?
Regards
Murray
Hi
Yes, I want to add an action column. Not to edit data but to launch an additional report on the subject of the row. ie. pass the rowid to a javascript function that will initiate the appropriate action. This column would be created as part of the pivot grid as the grid is first created not dynamically added. Is this possible?
Thank you.
Hi,
Yes I am trying to create a Master/Detail scene where the detail is a pivot grid.
You mentioned “if you need to load new data from server you will need to set it again to json.” So I adjusted the call to reset it as below.
// set the ouput format to json
$pivot->dataType=”json”;
// Set the url from where we obtain the data
$pivot->setData(index.php?Action=getData);
However when the pivot grid makes a request to get the data again it drops the
“?Action=getData”
from the call it makes. It actually seems to drop all but jqGrid params. Am I setting the data back to json in the right place / way?
Here is an example of the call the pivot grid makes on refresh:
index.php?_search=false&nd=1529311477741&rows=10&page=1&sidx=CategoryName&sord=asc
You can see it is missing the ?Action= param.
Thanks.
Thank you for the reply and example. I will study that and hopefully see where I am going wrong. As to the second part of my question, can you please confirm I can add columns to the pivot grid and place icons there that would activate actions relative to the row on which the icon is?
Many thanks
Murray
Many thanks for the reply. I have added $pivot->dataType=”json”; to the construction of the pivot grid but it makes no difference. Is this how it is supposed to be done?
1 2 3 4 5 6 7 8 9 10 11 |
// We should clear the grid data on second grid on sorting, paging, etc. $cleargrid = <<<CLEAR function(rowid, selected) { // clear the grid data and footer data jQuery("#ProjectCandidateList").jqGrid('clearGridData',true); } CLEAR; $grid->setGridEvent('onPaging', $cleargrid); $grid->setGridEvent('onSortCol', $cleargrid); |
is included in the calling grid.
Once this is working can you please confirm I can add columns as per normal grid into which I can place icons that will fire actions for the row.
Regards
Murray
Passing parameter to pivot grid fixed by using
jQuery("#ProjectCandidateList").jqGrid('setGridParam',{datatype: 'json',postData:{ProjectID:rowid}});
Select statement in pivot grid now correctly formed but still no data in pivot grid. It appears the pivot grid does not include the relevant parameters on the second pass when using $pivot->setData. Using $pivot->setUrl passes the parameters but has other issues. Can anyone please offer any clarification.
I have sorted out a number of issues in the above and have data in the pivot grid provided I hard code the $id in the select.
1 2 3 4 5 6 7 8 9 10 |
$selectproj = <<<PROJID function(rowid, selected) { if(rowid != null) { jQuery("#ProjectCandidateList").jqGrid('setGridParam',{postData:{projid:rowid}}); jQuery("#ProjectCandidateList").trigger("reloadGrid"); } } PROJID; $grid->setGridEvent('onSelectRow', $selectproj); |
in the first grid is correctly populating rowid and therefore projid, however this is not being picked up in the pivot grid. $_REQUEST is empty
1 2 3 4 5 6 7 8 |
if(isset($_REQUEST['projid'])) { $id = jqGridUtils::Strip($_REQUEST["projid"]); } else { $id = 0; } |
is jQuery(“#ProjectCandidateList”).jqGrid(‘setGridParam’,{postData:{projid:rowid}}); the correct way to pass the id to a pivot grid?
In answer to your question of the 30th. I am only posting the changed cell data from the inline edit on a single row at any one time.
Hi Will. while your solution works well wth triggering a javascript call when a selection is made from a dropdown using the dataEvents type=change; what would you use where the inline edit is a text box?
for drop down
$grid->setColProperty("TestType",array("label"=>"Type", "width"=>70, "editable"=>true, "edittype"=>"select", "editoptions"=>array("value"=>"{$types}", "dataEvents"=>array(array("type"=>"change", "fn"=>"js:function(e){updateFixed('test');}"))), "search"=>false, "sortable"=>true));
for text box
$grid->setColProperty("CuratorReference",array("label"=>"Curator Reference", "width"=>120, "sortable"=>true, "edittype"=>"text", "editable"=>true, "editoptions"=>array("dataEvents"=>array(array("type"=>"focusout", "fn"=>"js:function(e){updateFixed('curator');}")))));
in the latter case neither blur, nor focusout seem to work.
Hi Will
Your code works brilliantly:-
1 2 3 |
$grid->setColProperty("TestType", array("label"=>"Type", "width"=>70, "editable"=>true, "edittype"=>"select", "editoptions"=>array("value"=>"{$types}", "dataEvents"=>array(array("type"=>"change", "fn"=>"js:function(e){updateRandom();}"))), "search"=>false, "sortable"=>true)); |
It correctly calls updateRandom() which looks like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
function updateRandom(event) { var grid = $('#randomorderlist'); var rowKey = grid.jqGrid('getGridParam',"selrow"); var rows = grid.jqGrid('getDataIDs'); for (i = 0; i < rows.length; i++) { var rowData = grid.jqGrid('getRowData', rows<em class="d4pbbc-italic"></em>); var qid = rowData.CYOTestQuestionID; if (qid == rowKey) { var tqid = rowData.CYOQuestionID; var qid = rowData.CYOTestQuestionID; var TestType = rowData.TestType; var SubTest1 = rowData.SubTest1; var SubTest2 = rowData.SubTest2; var CuratorReference = rowData.CuratorReference; |
etc
The variables have the correct values except the drop down boxes eg. TestType contains the full html <select statement that makes up the dropdown without selected next to the selected item. How do I get the item that has been selected that has fired the Change event?
Thank you very much Will, I now have the alert I was expecting.
Hi Will, thank you for looking at this but unfortunately I am still not getting the alert box I would expect. Code is as follows:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
// Change some property of the field(s) $grid->setColProperty("CYOQuestionID", array("label"=>"QID", "width"=>30, "sortable"=>true)); $grid->setColProperty("CYOTestQuestionID", array("label"=>"ID", "key"=>true, "width"=>30, "sortable"=>true)); $grid->setColProperty("Title", array("label"=>"Title", "width"=>150, "editable"=>false, "sortable"=>true)); $grid->setColProperty("CuratorReference", array("label"=>"Curator Reference", "width"=>120, "editable"=>true, "sortable"=>true)); $grid->setColProperty("TestType", array( "label"=>"Type", "width"=>70, "editable"=>true, "edittype"=>"select", "editoptions"=>array("value"=>"{$types}","dataEvents"=>array("type"=>"change","fn"=>"js:function(e){alert('change noted');}")), "search"=>false, "sortable"=>true )); $grid->setColProperty("SubTest1", array("label"=>"Subtest 1", "width"=>60, "editable"=>true, "edittype"=>"select", "editoptions"=>array("value"=>"{$subtest1}"), "search"=>false, "sortable"=>true)); $grid->setColProperty("SubTest2", array("label"=>"Subtest 2", "width"=>60, "editable"=>true, "edittype"=>"select", "editoptions"=>array("value"=>"{$subtest2}"), "search"=>false, "sortable"=>true)); $grid->setColProperty("TestTypeID", array("label"=>"Test Type", "hidden"=>true, "width"=>30, "stype"=>"select", "searchoptions"=>array("searchhidden"=>true, "sopt"=>array("eq"),"value"=>"{$types}"))); $grid->setColProperty("SubTestID", array("label"=>"SubTest 1", "hidden"=>true, "width"=>30, "stype"=>"select", "searchoptions"=>array("searchhidden"=>true, "sopt"=>array("eq"),"value"=>"{$subtest1}"))); $grid->setColProperty("SubTest2ID", array("label"=>"SubTest 2", "hidden"=>true, "width"=>30, "stype"=>"select", "searchoptions"=>array("searchhidden"=>true, "sopt"=>array("eq"),"value"=>"{$subtest2}"))); $grid->setColProperty("tact", array("label"=>"Actions", "width"=>50, "editable"=>false, "search"=>false)); |
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top