Setting a column to be ignored in insert query.

QuestionsSetting a column to be ignored in insert query.
Juan Antonio Palacios asked 2 years ago

Hi Abu,

Currently i have a working Grid that uses a virtual (non-db) column to display a message inside the add and edit dialogs. The important parameters of the configuration are the following:

$col[“title”] = “WARNING:”; //the content of the field is set in the afterShowForm function
$col[“name”] = “virtual_col”;
$col[“show”] = array(“view”=>false, “add”=>true, “edit”=>true, “list”=>false);
$col[“editoptions”] = array(“readonly”=>”readonly”, “style”=>”border:0”);

When I try to update any row, the DB expectedly returns the error: “Unknown column ‘virtual_col’ in ‘field list’
I suppose I can work around that error defining on_insert and on_update functions and not including ‘virtual_col’ to be used in the custom query, is there an easier way to solve this? I have a lot of columns in that Grid, so the functions would be pretty big and I’d avoid that approach if it’s possible.

Thanks in advance

1 Answers
Mike answered 2 years ago

Turn-of the Add and Edit options – you have them set:

$col[“show”] = array(“view”=>false, “add”=>false, “edit”=>false, “list”=>false);

If you are looking to see the field, but not edit it in the pop-up form, you could also use

$col[“editable”] = false;

 

Thanks

 

Mike

Your Answer

11 + 4 =

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?