Hybrid View

  1. #1
    Sencha User
    Join Date
    Jul 2013
    Location
    Mysore, Karnataka, India
    Posts
    85
    Vote Rating
    6
    sanjayon19 is on a distinguished road

      0  

    Default Grid with Dynamic Columns in ExtJS 4.2.1 MVC

    Grid with Dynamic Columns in ExtJS 4.2.1 MVC


    Hi All,

    Can we create a Dynamic Grid? Lets say I want to display a grid on the center region of the Viewport.
    I'm following MVC approach in ExtJS 4.2.1 and hence I have defined a Model, View and controller for the Grid.

    Now I want the Grid to be dynamic, which means, based on the JSON data coming from the server, I want to create the Grid. If JSON data gives 3 columns with Column Header name and Content, I should display 3 columns. If it gives data for 5 columns with Column Header name and content, I should display 5 coulmns.

    Is it possible to have a common model to handle this?
    Please share an example if possible.

  2. #2
    Sencha User existdissolve's Avatar
    Join Date
    Jan 2010
    Location
    Kansas
    Posts
    522
    Vote Rating
    85
    existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice

      1  

    Default


    Check out this thread for an example: http://www.sencha.com/forum/showthre...e-Json-Request
    Before pasting your code, see if you can make a working example using Sencha Fiddle: https://fiddle.sencha.com/

    Not only will it let everyone see what you're talking about with their own eyes, but it also makes debugging your issue 19 billion times easier

    Embedding your newly created Fiddle is super-easy: Using Sencha Fiddle in the Forums

  3. #3
    Sencha User
    Join Date
    Jul 2013
    Location
    Mysore, Karnataka, India
    Posts
    85
    Vote Rating
    6
    sanjayon19 is on a distinguished road

      0  

    Default Can you please give me a working example?

    Can you please give me a working example?


    Hi Existdissolve,

    Thanks for the link. But somhow I'm still not convinced with the description.

    Can you please brief me about that like do we need to create the Model on the Fly?
    If so, how to configure the columns and the data to it?

    Can you please give me a sample example to my question above so that I can understand better?

  4. #4
    Sencha User existdissolve's Avatar
    Join Date
    Jan 2010
    Location
    Kansas
    Posts
    522
    Vote Rating
    85
    existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice

      1  

    Default


    Look at the live example in the link I posted. It has a working example of configuring a grid with dynamic columns and data returned from the server.

    Before pasting your code, see if you can make a working example using Sencha Fiddle: https://fiddle.sencha.com/

    Not only will it let everyone see what you're talking about with their own eyes, but it also makes debugging your issue 19 billion times easier

    Embedding your newly created Fiddle is super-easy: Using Sencha Fiddle in the Forums

  5. #5
    Sencha User
    Join Date
    Jul 2013
    Location
    Mysore, Karnataka, India
    Posts
    85
    Vote Rating
    6
    sanjayon19 is on a distinguished road

      0  

    Default I want to know the JSON format also. Request you to provide a sample example in MVC.

    I want to know the JSON format also. Request you to provide a sample example in MVC.


    As I'm following MVC approach in My application, I would like to know with little more details on how we can create Grids dynamically.

  6. #6
    Sencha User
    Join Date
    Jul 2013
    Location
    Mysore, Karnataka, India
    Posts
    85
    Vote Rating
    6
    sanjayon19 is on a distinguished road

      0  

    Default Thanks for the Example

    Thanks for the Example


    Hi Existdissolve,

    Your example helped me a lot to create the Dynamic Grid. I got the JSON format in your example when I opened in the JSFiddle.

    Thanks for the Post.

  7. #7
    Sencha User
    Join Date
    Jul 2013
    Location
    Mysore, Karnataka, India
    Posts
    85
    Vote Rating
    6
    sanjayon19 is on a distinguished road

      0  

    Default How to attach the store of the Dynamic Grid to the pagingtoolbar?

    How to attach the store of the Dynamic Grid to the pagingtoolbar?


    I got the dynamic Grid with above example. But how to attach the store of this dynamic grid to the pagingtoolbar so that we will be able to see how many records are there.

    I tried ;--> store:this.store but it didnt work.

    Can someone please suggest me how we can get this?

Thread Participants: 1

Tags for this Thread