Results 1 to 5 of 5

Thread: Getting a value in store with a variable

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Location
    Toulouse
    Posts
    62
    Answers
    7
    Vote Rating
    0
      0  

    Default Answered: Getting a value in store with a variable

    Hello everyone,

    Sorry my title isn't very clear. My problem is that I have dynamic models and store that I create into a string in PHP and the then 'eval' once the success is triggered from the AJAX request.
    In my PHP string, I need to do is something like this :

    Code:
    var fields = store$strUniqueId.getModel().getFields();
    var myItem = store$strUniqueId.getAt(i); 
    for(var j=0; j < fields.length; j++){         
    var myCurrentField = fields.getAt(j);
    var myCurrentFieldName = myCurrentField._name;
    var myCurrentFieldValue = myItem.data.myCurrentFieldName;                                                     
    $strGrid .= "console.debug(myItem.data.myCurrentFieldName);
    strHTML = strHTML + myCurrentField._name + ' : ' + myCurrentFieldValue + '<br />'; 
    ;
    with myCurrentFieldName being a variable. Does anyone have any ideas ?

    I can only seem to access the value of a specific field of a record using the actual name of the field. But I do not know it because my models are dynamic.

    Thanks guys

    Sarah
    Sarah Burrell
    R & D Developer at Novadys International

  2. Code:
                                $myContentHTML .= "<b>".$alias."</b> : ' + myItem.data.".addslashes(utf8_encode($myProperty->Name))." + '<br />' + '";
    I ended up doing this in a php servlet

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    So how do you know what field to use?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Oct 2012
    Location
    Toulouse
    Posts
    62
    Answers
    7
    Vote Rating
    0
      0  

    Default I don't know

    I want to iterate through them and render them as a "key : value" format
    Any ideas ?
    Sarah Burrell
    R & D Developer at Novadys International

  5. #4
    Sencha User
    Join Date
    Oct 2012
    Location
    Toulouse
    Posts
    62
    Answers
    7
    Vote Rating
    0
      0  

    Default So...

    I'm assuming this isn't possible and I'll have to find a work around
    Sarah Burrell
    R & D Developer at Novadys International

  6. #5
    Sencha User
    Join Date
    Oct 2012
    Location
    Toulouse
    Posts
    62
    Answers
    7
    Vote Rating
    0
      0  

    Default Still stuck

    Code:
                                $myContentHTML .= "<b>".$alias."</b> : ' + myItem.data.".addslashes(utf8_encode($myProperty->Name))." + '<br />' + '";
    I ended up doing this in a php servlet
    Sarah Burrell
    R & D Developer at Novadys International

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •