I have a field with values of either 1 or 0 so in my connector php I put
$gridConn->set_options("is_cl",array(0=>"No",1=>"Yes"));
This works great if I set the column type to coro, the header dropdown correctly says No/Yes instead of 0/1. But I don’t want the user to be able to change the value of the cell. If I change column type to just ro it only shows 1 or 0.
My goal is to display yes or no, and have the header filter where the user can choose to display just yes or just no, but not change the value of the cell.
Possible or no?
Greg
a) you can use beforeRender event on the server side and change 1 and 0 to the Yes and No from it
docs.dhtmlx.com/doku.php?id=dhtm … re_loading
or
b) you can continue to use co column in the grid, but add code like next to block edit operations for it
grid.attachEvent(“onEditCell”, function(stage, id, ind){
if (ind == INDEX_OF_CO_COLUMN) return false;
return true;
});
Thanks, I actually tried both of those.
With the a) solution, the drop down menu in the header still remained as 1 and 0 and with the b) solution, unfortunately the user is able to rearrange the columns so the index order became unreliable.
Greg
as for solution (a) - are you using client side or server side filtering in that scenario?
If you are using ro column - client side filter will show options with text, as it rendered in the grid. ( which will be Yes, No ) - server side filter will ask server, where you can use
$gridConn->set_options(“is_cl”,array(“No”=>“No”,“Yes”=>“Yes”));
as for solution (b) you can use
grid.setColumnIds(…)
and later
grid.getColIndexById
to convert id to index ( ids are consistent and can be used with movable columns )
Thanks, Stanislav.
The approach for solution A does not seem to be working for me.
Using
$gridConn->set_options("is_cl",array("No"=>"No","Yes"=>"Yes"));
server side correctly shows Yes/No in the dropdown, but doesn’t function, i.e. choosing Yes does not show the Yes’s/1’s, it shows 0 results.
Greg
the log shows this
SELECT * FROM business_ent WHERE tgp_id=40 AND tlead_type<'4' AND is_cl LIKE '%Yes%' LIMIT 0,200
So I suppose I will need to modify the beforeFilter event.
Greg
Yep, if you are using server side filtering - you need to use beforeFilter and change values back to 0 and 1