Make column readonly on add form

QuestionsMake column readonly on add form
Anand asked 5 days ago

I have a master-detail grid where I am trying to display ID and Name on the detail grid so users know what is the parent ID and Name for which they are adding the detail. Based on below configuration, name is passed to insert query that is sent to the detail table which I do not want. How can I make the name column appear in grid and add form as readonly but not send to the table during insert.

“`

$grid->select_command = “SELECT a.id, a.acq_price, a.acquisition_date, a.payment_schedule, a.payment_id, a.payment, a.payment_date, a.version, a.asset_id, s.name as asset_name
FROM griddemo.acq_acquisition_info a
JOIN griddemo.acq_asset_info s ON a.asset_id = s.id
WHERE a.asset_id IN ($id_acq)”;
// this db table will be used for add,edit,delete
$grid->table = “acq_acquisition_info”;
$cols = array();
$col = array();
$col[“title”] = “id”;
$col[“name”] = “id”;
$col[“dbname”] = “a.id”;
$col[“hidden”] = true;
$cols[] = $col;
$col = array();
$col[“title”] = “Asset ID”;
$col[“name”] = “asset_id”;
$col[“dbname”] = “a.asset_id”;
$col[“editable”] = true;
$col[“editoptions”] = array(“readonly”=>”readonly”);
$cols[] = $col;
$col = array();
$col[“name”] = “asset_name”;
$col[“title”] = “Asset Name”;
$col[“dbname”] = “s.asset_name”;
$col[“width”]= “150” ;
$col[“editrules”][“readonly”] = true;
$col[“editable”] = true;
// shows defaultValue only on add dialog and readonly
$col[“editoptions”] = array(“readonly”=>”readonly”, “style”=>”border:0”);
$cols[] = $col;
“`

1 Answers
Anand answered 5 days ago

Gist link here

Your Answer

11 + 18 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?