Hi, I need help!!! I have a table with INDEX = codalbaran, numlinea, (name PRIMARY), The Grid Works perfect, it show me all but it don't delete or edit. I read about custom delete but I don't find more information.
$col = array();
$col["title"] = "Id"; // caption of column
$col["name"] = "codalbaran, numlinea"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
or changes for this and also it works but the same problem
$col["name"] = "PRIMARY"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col["width"] = "10";
$col["hidden"] = true;
$cols[] = $col;
For composite keys – there are two possible approaches:
1) Creating a new AUTO_INCREMENT column directly in the database, so that each row has a unique id, then using this column for primary key. You can hide the column using hidden => true.
2) In your SELECT statement (select_command), you may try to select a first column as special concat value
e.g. select concat(codalbaran, '-', numlinea) as pk …
that is based on composite keys. This will handle the listings. For updates, you need to manually manage on_update or on_insert code using custom events (as in demos/editing/custom-events.php)
In callbacks, you can split this key, and execute insert/update/delete queries manually.
HI I try
$g->select_command = "SELECT * FROM (SELECT i.codalbaran, i.numlinea, c.referencia, c.descripcion, i.cantidad, i.importe, CONCAT(i.codalbaran, '-', i.numlinea) as codnum FROM pedidoslineatmp i INNER JOIN articulos c ON i.codigo = c.codarticulo WHERE i.codalbaran= '$pid') o";
and the Grid show the CONCAT but the same problem, don't edit, update…
$col = array();
$col["title"] = "Id"; // caption of column
$col["name"] = "codnum"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col["width"] = "20";
//$col["hidden"] = true;
$cols[] = $col;
Could you write complete URL?
…demos/editing/custom-events.php (I don't find it)