Jump to content

Recommended Posts

Posted

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.

image.thumb.png.9eb66d16ccc55978fd928dd85fde1944.png

Posted
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");
    };
}

 

  • Like 1
Posted
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.

Posted
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.

  • 1 year later...
Posted
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);
        };
    }; 
}
  • 1 year later...
Posted

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

Posted
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.

Posted
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");
    };
}

 

  • Like 1
Posted
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

  • Thanks 1
  • 3 months later...
Posted

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.

image.thumb.png.2e74051ff6bd1275e48bf37036834c94.png

  • 2 months later...
Posted
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 :)

  • Thanks 1
  • 4 months later...
Posted
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

Posted

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.

Posted
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...