Ellen
Ellen

Reputation: 107

Tagfield does not work properly when hiding a widgetСolumn

I have a grid with windegColumns. And it all works right. But if you manually hide the Num column, the tagfild widget does not work correctly. New values are not set, old values are not deleted. Unsaved values are reset. In my application, I need to dynamically hide or show the column containing the widget at the click of a button. But when I do this, my Tagfield breaks

My fiddle: https://fiddle.sencha.com/#view/editor&fiddle/3db6

Just hide the Num column in the table and try to change the Tegfield value and you will see

Any idea why this is happening and how to fix it?

Upvotes: 0

Views: 205

Answers (2)

wahab memon
wahab memon

Reputation: 2416

After removing the dataIndex from your tagfield column, the selecting of new values or removing or retaining after hiding the column works properly. A similar fiddle was available where the dataIndex was not provided. Still, not sure why it behaves like this. It probably does not store the selected values anywhere and reloads the widget store. Tried the same with combobox but it just resets the fields and still allows selecting of values after we hide the column.

Upvotes: 0

incutonez
incutonez

Reputation: 3331

It looks like there might be a bug with using the dataIndex instead of bind. Per the docs, you get a record property for each row for free, and if it doesn't work, you may have to explicitly set a rowViewModel. I would recommend using binding here regardless:

xtype: 'widgetcolumn',
cellWrap: true,
text: 'Phone',
// Notice I took out the dataIndex here
flex: 1,
widget: {
    xtype: 'tagfield',
    // Added bind
    bind: {
        value: '{record.phone}'
    },
    // rest of code

Upvotes: 1

Related Questions