Page 1 of 1

Dynamic Ubergrid

Posted: Fri Jul 05, 2013 7:49 pm
by osolano
Hi,

I was wondering if anyone has any ideas on how to setup a grid to show data dynamically without a model? Say for example I pass a url that will return a json document but i want the header to show with the name of the key and the values to obviously pull under it.

I ask because the data I pull from frequently changes, where new fields come in or out.

Regards,
Oliver

Re: Dynamic Ubergrid

Posted: Sat Jul 06, 2013 4:14 pm
by mats
This is not currently supported, I think the easiest way would be to destroy and recreate the again.

Re: Dynamic Ubergrid

Posted: Wed Sep 11, 2013 7:30 pm
by osolano
mats,

Two questions.
1. Is it possible to just change the store and refresh data? It doesn't seem to be working for me.
2. How would you add ubergrid programmatically? I've tried the following
var ubergrid = Ext.create('Ext.Panel',{
	extend: 'Ext.Panel',
    alias: 'widget.ubergrid',
    store:'MyStore',
    columns:[
        {
            header:'name',
            dataIndex:'name'
        }]
});

this.add(ubergrid);
but it doesn't seem to do anything.

Oliver

Re: Dynamic Ubergrid

Posted: Wed Sep 11, 2013 7:44 pm
by nickolay
Oh, you've mixed class declaration (exten + alias) and instantiation (Ext.create) together.

Should probably look something like:
var ubergrid = Ext.create('UberGrid.Panel', {
    store:'MyStore',
    columns:[
        {
            header:'name',
            dataIndex:'name'
        }
     ]
})

Re: Dynamic Ubergrid

Posted: Wed Sep 11, 2013 8:00 pm
by osolano
awesome that works!

thanks again for the awesome support!

Re: Dynamic Ubergrid

Posted: Fri Sep 13, 2013 9:41 pm
by osolano
This is more of a sencha question, but I was hoping you can help me out since it is using ubergrid.

With the dynamic change of ubergrid I need to basically,

Create Store
Set Model
Set ubergrid store
Set ubergrid columns.
repeat for different data.

Is there any way to programatically create a new model and keep the store the same? It doesn't seem to work, and seems as if I'd have to create a model for everytype of table my store can return.
My trouble is that I don't want to create a store everytime I call my database for basically a different table with different column.
For example,

If i get a table that returns Name and Category, but then I have another table that returns Name and Product I want to be able to change the store so that it points to a different model.

Re: Dynamic Ubergrid

Posted: Fri Sep 13, 2013 9:44 pm
by mats
I think this is better asked in the Sencha forums as we didn't design the Sencha data package. I haven't seen any mention of a 'setModel' or similar API on the store though, would be cool if it existed...

Re: Dynamic Ubergrid

Posted: Mon Sep 16, 2013 7:48 am
by nickolay
May be you can just add/remove columns? And have a model with all fields defined?