Hybrid View

  1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    64
    Vote Rating
    0
    bluesapphire is on a distinguished road

      0  

    Question How to display JsonReader data in Alert

    How to display JsonReader data in Alert


    Hi!
    I am collecting data of a store through JSON Reader. Data received from server is in following format:

    Code:
    ({"rights": "No Rights", "total":"2","results":[{"id":"10","c_code":"US","country":"United States"},{"id":"11","c_code":"UK","country":"United Kingdom"}]})
    I have a button in Top Toolbar of a grid. When I click on this button, I want to display 'rights' value in alert message box. How it would be possible.

    Can someone help me in this regards

    Thanks in advance

  2. #2
    Ext User
    Join Date
    Jan 2008
    Posts
    70
    Vote Rating
    0
    NeonMonk is on a distinguished road

      0  

    Default


    http://localhost/extjs/docs/?class=Ext.data.Store

    Read up on methods getAt()

    Then read http://localhost/extjs/docs/?class=Ext.data.Record

    get()

    Eg:

    PHP Code:
    var index 0;
    var 
    record randomStore.getAt(index);
    alert(record.get('rights')); 

  3. #3
    Ext User
    Join Date
    Sep 2007
    Posts
    64
    Vote Rating
    0
    bluesapphire is on a distinguished road

      0  

    Question


    Hi!
    Thanks for guidance. But it is displaying 'Undefined'.

    For demo, kindly visit following link :

    http://vibersol.com/sitesdemo/rq/ind...admin/country/

    Then click on 'Add Record' link.

  4. #4
    Ext User
    Join Date
    Sep 2007
    Posts
    64
    Vote Rating
    0
    bluesapphire is on a distinguished road

      0  

    Question


    Still waitng for some pin point solution....

    Thanks in advance

  5. #5
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    0
    devnull has a little shameless behaviour in the past

      0  

    Default


    I am not going to dig through your js files just to find the right section of code. If you want us to help you, you need to put a little bit of effort into providing the right information.

  6. #6
    Ext JS Premium Member NoahK17's Avatar
    Join Date
    Apr 2008
    Location
    Atlanta, GA
    Posts
    518
    Vote Rating
    1
    NoahK17 is on a distinguished road

      0  

    Default


    I get an error: [Break on this error] alert(record.get('rights'));

    record is not defined.
    Noah
    Senior Web Developer
    NBA.com