1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
    Burm is on a distinguished road

      0  

    Default Unanswered: Create grid dynamically with database

    Unanswered: Create grid dynamically with database


    Hello everyone,

    I would like to create a grid dynamically(interface, column model, etc.) with the database.
    Is it possible?

    Regards,
    Burm

    Note: I'm using GXT 3.0.1

  2. #2
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    If you're talking about a SQL table whose columns are not known/defined ahead of time I would seriously question your rationale for doing this.

    That said, this may be possible assuming you can at the very least have some sort of POJO representation of your database fields (perhaps through autobeans) and then having a ColumnConfig<YourAutoBean, Object>. But you would still need to define a ModelKeyProvider for YourAutoBean (and you would need to ensure the value returned is unique across all your model objects) and ValueProviders for each column.

    And then...you'll probably need custom cell renderers for each of your "Object" objects because I'm not sure if the default is toString() or if it is, whether or not it is what you want.

    Most of the time I see requests like this, i.e., ones that are incredibly uncommon, I have to stop and encourage the requester to seriously evaluate the requirements he or she *thinks* he or she "needs."

    My suggestion would be to NOT pursue this line of development because I'm pretty sure you will find it rather frustrating and few people, if any, willing to help.

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
    Burm is on a distinguished road

      0  

    Default


    First off all, thanks for the reply and sorry for not answering early.

    In previous versions of the GXT was not necessary to create this structure (model key providers, value providers ...) or am I mistaken?

    Regards.

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Answers
    109
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    In earlier GXT versions, the *only* way was to use a sort of Map<String, Object> to describe everything - by removing that requirement in GXT 3, apps can be more specific and maintainable, and apps can compile smaller. You can still use very flexible objects like that to send unknown data over the wire.

    Two ways to go forward:
    Try making a model that describes your database and rows - each row probably has a Map<String, Object>, a String that is the db or type name itself, and a String that is the ID. Then, build a ValueProvider that lets you access each of those values in the map - check out the blog post Brendan did a few months ago under the ValueProvider heading for a sample implementation:
    http://www.sencha.com/blog/building-gxt-charts/
    http://staging.sencha.com/examples-d...namiclinechart

    Another way - the 3.0 gxt-legacy.jar still contains ModelData and BaseModelData as the 2.x jar did, and has a built-in ValueProvider meant to handle those types. This might make some of your changes a little easier, allowing you to use the same idea. Note, however, that this is only intended as a way to make moving from 2.x to 3 easier - the first option is really the same as this one, but it makes you look at your model a little more closely.

  5. #5
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
    Burm is on a distinguished road

      0  

    Default


    Hello Colin,
    I'll analyze your suggestions and try to do what I want.


    Thanks

Thread Participants: 2

Tags for this Thread