Column Hiding

36 views
Skip to first unread message

Mi-e Foame

unread,
Aug 4, 2014, 2:35:11 PM8/4/14
to gl...@googlegroups.com
Hey all!

I've been having a blast with GluJS these past months. I can usually figure out solutions to my own problems these days, but today I stumbled upon one that is a bit unusual for me. I'm trying to keep track of when a user wants to show/hide a grid column. I used the "hidden" config option on the column definition to bind it to a property in my viewmodel. Something along the lines of:

glu.defModel('foo.bar', {
    hideColumn: false
});

glu.defView('foo.bar', {
    xtype: 'grid',
    columns: [{
        header: 'Blah',
        hidden: '@{hideColumn}'
    }]
});

When I load the app, I get, "[E] Layout run failed".

Has anyone else seen this? Any pointers for how to go about fixing this? I assume I'll have to muck with an adapter somewhere, but I've not had to do much of that yet.

Thanks!
Josh

Ryan Smith

unread,
Aug 5, 2014, 2:29:38 PM8/5/14
to gl...@googlegroups.com
Hey Josh,

Its been a while since I've had to do this as well, but the exception you are getting is likely because the hidden property needs to be a boolean for extjs to correctly set the hidden state of the column.  So there is no "out of the box" hide/show for columns like you would hope for with GluJS... sorry to say.  However, with all things... where there is a will, there is a way.

What you can do is listen on the hide/show event on the grid for all columns and update the property in your viewmodel accordingly.  Something like this might work?

listeners: {
    columnhide: function(ct, column, eOpts){
        grid.vm.set(column.dataIndex + 'Hidden', column.hidden)
    },
    columnshow: function(ct, column, eOpts){...}
}

As for the reverse, you could listen on any of those properties changing in your viewmodel and fire a grid.reconfigure event when any of those properties change (probably not the most efficient way, but it would certainly get the job done for a first pass).

Hopefully that helps!  Let me know if I can be any more help :)

-Ryan


--
You received this message because you are subscribed to the Google Groups "GluJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to glujs+un...@googlegroups.com.
To post to this group, send email to gl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/glujs/66c74bae-3e06-44aa-a783-f489075ee8e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages