MarkB Posted March 3, 2020 Posted March 3, 2020 I'd like to have a ColumnWidget with a button but I need the buttons to be able to be disabled based upon a value in the row they are in. Quote
Sherzod Posted March 3, 2020 Posted March 3, 2020 35 minutes ago, MarkB said: I'd like to have a ColumnWidget with a button but I need the buttons to be able to be disabled based upon a value in the row they are in. function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var widgetColIndx=1; columns[widgetColIndx].onWidgetAttach = function(column, widget, record) { widget.setDisabled(record.get(widgetColIndx) == "Blue Angelfish"); }; } 1 Quote
MarkB Posted March 5, 2020 Author Posted March 5, 2020 On 3/3/2020 at 10:51 AM, Sherzod said: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var widgetColIndx=1; columns[widgetColIndx].onWidgetAttach = function(column, widget, record) { widget.setDisabled(record.get(widgetColIndx) == "Blue Angelfish"); }; } Thanks. This kind of works. If a round trip is made to the server and all rows are returned it works. But if you edit the row and change the value to a valid state, the state of the button does not change. Quote
Sherzod Posted March 5, 2020 Posted March 5, 2020 7 hours ago, MarkB said: But if you edit the row and change the value to a valid state, the state of the button does not change. Please explain. Quote
Yai_NP_TH Posted May 20, 2021 Posted May 20, 2021 function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var widgetColIndx=1; columns[widgetColIndx].onWidgetAttach = function(column, widget, record) { if (record.get(widgetColIndx) == "Blue Angelfish") { widget.setvisible(true); } else { widget.setvisible(false); }; }; } Quote
fraxzi Posted February 22, 2023 Posted February 22, 2023 Hi @Sherzod, I confirmed that: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var widgetColIndx = 2; columns[widgetColIndx].onWidgetAttach = function(column, widget, record) { widget.setDisabled(record.get(widgetColIndx) != "0"); }; } Doesn't work if dgbrid.Options.dgRowNumbers := true ... works only of set to false.. I need the row number. What is the alternative? I tried widgetColindx = 3 with row number but it didn't work as well. Thanks, Frances Quote
Sherzod Posted February 22, 2023 Posted February 22, 2023 19 minutes ago, fraxzi said: Doesn't work if dgbrid.Options.dgRowNumbers := true ... works only of set to false.. I need the row number. What is the alternative? Hello, Yes. Quote
Sherzod Posted February 22, 2023 Posted February 22, 2023 20 minutes ago, fraxzi said: I tried widgetColindx = 3 with row number but it didn't work as well. The reason it doesn't work: record.get(widgetColIndx) Quote
Sherzod Posted February 22, 2023 Posted February 22, 2023 28 minutes ago, fraxzi said: What is the alternative? Solution for both cases: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var delta=0; if (columns[0].xtype && columns[0].xtype == 'rownumberer') { delta = 1; } var widgetColIndx = 1; //Index without regard to rownumberer columns[widgetColIndx + delta].onWidgetAttach = function(column, widget, record) { widget.setDisabled(record.get(widgetColIndx) == "Blue Angelfish"); }; } 1 Quote
fraxzi Posted February 22, 2023 Posted February 22, 2023 29 minutes ago, Sherzod said: Solution for both cases: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var delta=0; if (columns[0].xtype && columns[0].xtype == 'rownumberer') { delta = 1; } var widgetColIndx = 1; //Index without regard to rownumberer columns[widgetColIndx + delta].onWidgetAttach = function(column, widget, record) { widget.setDisabled(record.get(widgetColIndx) == "Blue Angelfish"); }; } You're the Man! @Sherzod, Works superbly! Thanks much, Frances 1 Quote
sicoobcooplivre Posted June 19, 2023 Posted June 19, 2023 @SherzodGood morning! Please, is there a possibility of leaving the button invisible instead of deactivating it? This topic helped me a lot, but my user wanted it to be invisible, if possible! Thank you for your attention! Quote
Sherzod Posted June 19, 2023 Posted June 19, 2023 Hello, 34 minutes ago, sicoobcooplivre said: Please, is there a possibility of leaving the button invisible instead of deactivating it? This topic helped me a lot, but my user wanted it to be invisible, if possible! Thank you for your attention! Just use setHidden instead of setDisabled. Quote
sicoobcooplivre Posted June 19, 2023 Posted June 19, 2023 Thank you very much! It worked out! Great week! Quote
Yakup ULUTAŞ Posted September 13, 2023 Posted September 13, 2023 On 3/3/2020 at 8:51 PM, Sherzod said: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var widgetColIndx=1; columns[widgetColIndx].onWidgetAttach = function(column, widget, record) { widget.setDisabled(record.get(widgetColIndx) == "Blue Angelfish"); }; } Thank you, it helped me a lot now 1 Quote
fraxzi Posted January 18, 2024 Posted January 18, 2024 On 2/22/2023 at 12:56 PM, Sherzod said: Solution for both cases: function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var delta=0; if (columns[0].xtype && columns[0].xtype == 'rownumberer') { delta = 1; } var widgetColIndx = 1; //Index without regard to rownumberer columns[widgetColIndx + delta].onWidgetAttach = function(column, widget, record) { widget.setDisabled(record.get(widgetColIndx) == "Blue Angelfish"); }; } Hi @Sherzod, I tried this solution with Grouped dbGrid and I couldn't make it work like the one Not Grouped. Any suggestion? Thanks, Frances Quote
Sherzod Posted January 18, 2024 Posted January 18, 2024 Hello @fraxzi Yes, you need to modify the code for this, there are several examples on the forum using the reconfigure function that can help you. You can analyze these examples and apply them in your project, I'll try later. Quote
fraxzi Posted January 22, 2024 Posted January 22, 2024 On 1/18/2024 at 12:16 PM, Sherzod said: Hello @fraxzi Yes, you need to modify the code for this, there are several examples on the forum using the reconfigure function that can help you. You can analyze these examples and apply them in your project, I'll try later. Hi @Sherzod, I looked at all available post but still couldn't figure it out. Could you help me out please. Thanks, Frances Quote
Sherzod Posted January 22, 2024 Posted January 22, 2024 Hello @fraxzi I'll try, but you might also find this post helpful: Quote
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.