1. #1
    Sencha User berlamont's Avatar
    Join Date
    Apr 2008
    Location
    Grand Rapids, MI
    Posts
    25
    Vote Rating
    1
    berlamont is on a distinguished road

      0  

    Question Unanswered: Creating and naming a list of buttons from a record's item list

    Unanswered: Creating and naming a list of buttons from a record's item list


    I've searched seemingly everywhere for something I thought would be easy.

    I would like a list of buttons from a JSON record.
    The number of items varies so I be sure of anything except maybe the total.*it would be preferred if I wasn't relying on that*
    Anyway here is an example of the JSON I'm working with and the users record that I want to create the buttons for:
    PHP Code:
    {
    "users": [
    "John",
    "Jason",
    "Amy",
    "Mike"
    ],
    "success":"true",
    "total":6

    I followed the example in the docs dataview guide which uses:
    PHP Code:
    config: {
              
    nameButtontrue,
              
    dataMap: {
             
    getNameButton: {  
                                 
    setText'name'
                                         
    }
                               }

    This does work, yet only to show the right number of buttons. Since my record items returned do not have a handle like "name" the buttons rightly remain blank. I would be grateful to anyone who has a thought or suggestion.

    One thought I had was to recursively add whatever property I needed after the store loaded to the records items, but so far no luck. I'm going to keep looking and trying, but hopefully someone can help or point me in the right direction.

    FYI: NO I cannot change the json returned from the server side, so I get what I get
    also the 'total' field might not always refer to the record I need.

    Thank you.

  2. #2
    Sencha User berlamont's Avatar
    Join Date
    Apr 2008
    Location
    Grand Rapids, MI
    Posts
    25
    Vote Rating
    1
    berlamont is on a distinguished road

      0  

    Default question

    question


    hmm I hope this isn't that dumb of a question and at least one person replies

  3. #3
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,964
    Answers
    331
    Vote Rating
    132
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    It is hard to tell what you are doing wrong without code or preferably a fiddle, https://fiddle.sencha.com/#home.
    I take it you are trying to have a dataview with components. In that case you should set the 'text' config to the model field that will hold your button text like the example in the following doc page. I hope this helps.
    http://docs.sencha.com/touch/2.3.1/#...onent.DataItem
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

Thread Participants: 1

Tags for this Thread