Lone Wolf Posted May 2, 2022 Share Posted May 2, 2022 Hi, I've a question about DBGrid action column. I've a DBGrid such the one I attach here. As you can see I've a column (titled Certified) that show the content of a Boolean field in my database. The column at the right of this one is an action column. I would like to enable (eventually show or hide the image "Certify >" accordingly to the boolean field. Is this one is True I want to disable the action column; if False I want to enable it. This must be done for each record in my grid. There is a way to reach this task? Many thanks for your anser Eros Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 2, 2022 Share Posted May 2, 2022 Hello, 16 minutes ago, Lone Wolf said: I would like to enable (eventually show or hide the image "Certify >" accordingly to the boolean field. Is this one is True I want to disable the action column; if False I want to enable it. This post may help you: Quote Link to comment Share on other sites More sharing options...
Lone Wolf Posted May 2, 2022 Author Share Posted May 2, 2022 Hi Sherzod, I've seen this post but I don't understand well how to apply to my case Eros Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 2, 2022 Share Posted May 2, 2022 7 minutes ago, Lone Wolf said: to apply to my case Can you make a simple testcase to check if possible? Quote Link to comment Share on other sites More sharing options...
Lone Wolf Posted May 2, 2022 Author Share Posted May 2, 2022 Ok! I attach a simple example. I've a table with a field called "FlagActive" which is a boolean and other fields I've created a DBGrid with the two fields on my in memory table: the description and the flag field. In the DBGrid I've created also an action column with a button. I would like to have this button enabled in the FlagActive field is True and disable for the false value of this field so, in my case the third record button (Record number 3) should be disabled and (possibly) hide. How can I reach this? Many thanks for your answer Eros App_002.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 2, 2022 Share Posted May 2, 2022 Ok thanks. I will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 2, 2022 Share Posted May 2, 2022 1 hour ago, Lone Wolf said: App_002.zip 99.65 kB · 0 downloads Try this approach: UniDBGrid1.ClientEvents.ExtEvents -> function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { dataColIndx = 1; actionColIndx = 2; actionItemsIndx = 0; columns[actionColIndx].items[actionItemsIndx].isActionDisabled = function (grid, rowIndex, colIndex, items, record) { return (record.data[dataColIndx] === false); }; } Quote Link to comment Share on other sites More sharing options...
Lone Wolf Posted May 2, 2022 Author Share Posted May 2, 2022 In this way it works! many thanks for your help! Eros 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.