Dynamic Ubergrid

Questions related to our Sencha Touch based grid component
Post Reply
User avatar
osolano
Posts: 27
Joined: Sat Jun 15, 2013 2:44 pm

Dynamic Ubergrid

Post 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

User avatar
mats
Core Developer
Core Developer
Posts: 16716
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Dynamic Ubergrid

Post by mats »

This is not currently supported, I think the easiest way would be to destroy and recreate the again.
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
osolano
Posts: 27
Joined: Sat Jun 15, 2013 2:44 pm

Re: Dynamic Ubergrid

Post 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

Code: Select all

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

User avatar
nickolay
Core Developer
Core Developer
Posts: 3466
Joined: Mon May 16, 2011 10:48 am

Re: Dynamic Ubergrid

Post by nickolay »

Oh, you've mixed class declaration (exten + alias) and instantiation (Ext.create) together.

Should probably look something like:

Code: Select all

var ubergrid = Ext.create('UberGrid.Panel', {
    store:'MyStore',
    columns:[
        {
            header:'name',
            dataIndex:'name'
        }
     ]
})
We offer training in both Ext JS and our products, read more here.
Read the API documentation

User avatar
osolano
Posts: 27
Joined: Sat Jun 15, 2013 2:44 pm

Re: Dynamic Ubergrid

Post by osolano »

awesome that works!

thanks again for the awesome support!

User avatar
osolano
Posts: 27
Joined: Sat Jun 15, 2013 2:44 pm

Re: Dynamic Ubergrid

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

User avatar
mats
Core Developer
Core Developer
Posts: 16716
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Dynamic Ubergrid

Post 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...
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
nickolay
Core Developer
Core Developer
Posts: 3466
Joined: Mon May 16, 2011 10:48 am

Re: Dynamic Ubergrid

Post by nickolay »

May be you can just add/remove columns? And have a model with all fields defined?
We offer training in both Ext JS and our products, read more here.
Read the API documentation

Post Reply