Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






Include combobox in the inline editing

No Tags
UserPost

00:40
08/05/2012


trufo_1

New Member

posts 1

Hi,


I would like to include a combo box in the inline editing. I am using the following code but when I select a value and I finish the edition, it changes again to the previous value. What am I doing wrong?


Thank you very much in advance.


This is the concrete line:

$grid->setSelect("CustomerID", "SELECT DISTINCT CustomerID, CustomerID FROM orders", true, true, false, array(""=>"Todas"));


This the complete code:

<?php
ini_set("display_errors","1″);
require_once 'jq-config.php';
require_once "php/jqAutocomplete.php";
require_once "php/jqCalendar.php";
require_once "php/jqGrid.php";
require_once "php/jqGridPdo.php";
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
$conn->query("SET NAMES utf8″);

$grid = new jqGridRender($conn);
$grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders';
$grid->dataType = 'json';
$grid->table ="orders";
$grid->setPrimaryKeyId("OrderID");
$grid->setColModel();
$grid->setUrl('myfirstgrid.php');
$grid->cacheCount = true;
$grid->setGridOptions(array(
    "caption"=>"This is custom Caption",
    "rowNum"=>10,
    "sortname"=>"OrderID",
    "hoverrows"=>true,
    "rowList"=>array(10,20,50),
    "postData"=>array("grid_recs"=>776)
    ));
$grid->setColProperty("OrderID", array("label"=>"ID", "width"=>60, "editable"=>false));
$grid->setColProperty("OrderDate", array(
    "formatter"=>"date",
    "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"m/d/Y"), "editable"=>false
    )
);
$grid->setColProperty("ShipName",array("editable"=>false));
$grid->setDatepicker("OrderDate",array("buttonOnly"=>false));
$grid->setSelect("CustomerID", "SELECT DISTINCT CustomerID, CustomerID FROM orders", true, true, false, array(""=>"Todas"));
$grid->datearray = array('OrderDate');
$grouping = <<< GROUP
jQuery("#grid").jqGrid('setGroupHeaders',{
    "useColSpanStyle":false,
    "groupHeaders" : [
        { "startColumnName":'OrderID', "numberOfColumns":2, "titleText":'Order Info' },
        { "startColumnName":'CustomerID', "numberOfColumns":3, "titleText":'Shipping Details' }
    ]
});
GROUP;
$grid->setJSCode($grouping);
$grid->navigator = false;
$onselrow = <<< ONSELROW
function(rowid, selected)
{
    if(rowid && rowid !== lastSelection) {
        $("#grid").jqGrid('restoreRow', lastSelection);
        $("#grid").jqGrid('editRow', rowid, true);
        lastSelection = rowid;
    }
}
ONSELROW;
$grid->setGridEvent('onSelectRow', $onselrow);
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;

?>

No Tags

About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

34 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9596

Posts: 28792

Membership:

There are 10195 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1157

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (7010 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information