Hi Abu!
I will like to make in the parameter "editoptions" a default value when ever I add a record to the grid.
$col = array();
$col["title"] = "Status"; // caption of column
$col["name"] = "status"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
$col["editable"] = true;
$col["edittype"] = "select"; // render as select
$str5 = "1:Nuevo;2:En Proceso;3:Resuelto;4:No resuelto";
$col["stype"] = "select"; // enable dropdown search
$col["editoptions"] = array("defaultValue" => "Nuevo");
$col["searchoptions"] = array("value" => ":;".$str5);
$col["formatter"] = "select"; // display label, not value
$col["width"] = 100;
$cols[] = $col;
I create this code but it doesn't display anything when I want to select the option Nuevo when I add a record.
I need the first option (1:Nuevo) to be the default one.
You can replace edtoptions with:
$col["editoptions"] = array("value"=>$str5, "defaultValue" => "1");
Hi Abu!
With this configuration of the dropdown, I can select the 4 options, but now I want only to show the first element, not the rest of the list.
When the user adds new records, it should only pick the 1st element, but I can't trust the user, so I need the dropdown with only one option to select.
In the other hand, another user different from who created the record should change this column to the other 3 options.
How can I make this column editable when the user adds records and not editable when he wants to update the record?
I've already tried different options, like using the defaultValue but it seems not to work, because it displays the other 3 options, I don't want that.
Thanks.
If you want to show only first element when adding, you can remove other options using js code.
$opt["add_options"]["afterShowForm"] = 'function () { $("#status").children("option:not(:first)").remove(); }';
$g->set_options($opt);
This will remove all status except first only for add dialog, and let it run as usual for edit.
necesito colaborador proyecto , no se ingles y mecuesta enterarme en el forum
soy de cadiz , trabajo en proyecto con base de datos oficiales
a ser posible viva por andalucia y que tenga experiencia DBA
[email protected]
ruego mail y tfno