1. #1
    Ext User
    Join Date
    Jun 2010
    Posts
    2
    Vote Rating
    0
    emoshag is on a distinguished road

      0  

    Default Loading dynamic JSON elements into one model/column from MongoDB.

    Loading dynamic JSON elements into one model/column from MongoDB.


    I am having a really hard time getting my head around this particular problem.

    I am trying to build an app that allows me to read a limitless combination of key value pairs into an Ext grid. I am retrieving the data from a MongoDB collection that has anywhere from 5 to infinite key value pairs in it.

    Each returned JSON Object will have at least 5 key value pairs. And every single Object will have 4 universal K/Vs. This is what I am referring to:

    [{"_id":: 12345, "instance": '101', "date": "2013-01-01", "level": "INFO", "submitted": "yes"},
    {"_id":: 12345, "instance": '101', "date": "2013-01-01", "level": "INFO", "submitted": "yes", "broken": "yes"},
    {"_id":: 12345, "instance": '101', "date": "2013-01-01", "level": "INFO", "bytes": 3413, "broken": "yes", "errorcode": 716}]

    What I want to do is display a 5 column grid and merge all the non universal columns into one column. There is also a possibility of taking the non universal columns and creating a row expander with a template.

    I haven't the slightest idea on how to do this... but the concept I was playing around with was this:

    1. AJAX request for all of the keys in the collection.
    2. Build a model using EVERY key.
    3. Define a column model for the 4 universal data entities and one blank "custom" column.
    4. Create a store that requests the data.
    5. Merge all the data into the "custom column."

    I simply have no idea where to start in terms of writing this functionality because the keys in this data are unknown and are different for each object.

    Anyone attempted to try this before? I have tried a bunch of suggestions from the forum and even played around with the Dynamic Model Example from the forums. Simply put... how do I create a model where I am merging a bunch of K/V entities from a JSON object into one column when I don't know the key names or how many there are?

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,468
    Vote Rating
    202
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    I'm not quite sure what you're wanting to do just yet. Can you explain once more? It also might to get community involvement if you can post what you've done so far to give folks something to work from. If you can post your model/store/grid test case and a snippet of data you might expect from the server response that might help in getting folks engaged.
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

Thread Participants: 1

Tags for this Thread