Results 1 to 3 of 3

Thread: jsonReader ComboBox Question

  1. #1
    Sencha User StevenInc's Avatar
    Join Date
    Jul 2009
    Location
    San Francisco
    Posts
    75
    Vote Rating
    0
      0  

    Default jsonReader ComboBox Question

    I am very new to EXT JS, so first off I want to express my gratitude to anyone who takes the time to respond.

    I bought the book "Learning Ext JS" by
    Colin Ramsay, Shea Frederick, Steve 'Cutter' Blades and in the book they give an incomplete example of populating a combobox with a JSON data feed from a PHP server. I have been attempting to recreate this example but I am having no success at it. There is a catch, I am not using a PHP server. I am using a coldfusion 8 server. I wrote a static .cfm template (chap3PHPformatedData.cfm) to return the following PHP formated json data set:

    {rows:[{"id":"1","genre_name":"Comedy","sort_order":"0"},{"id":"2","genre_name":"Drama","sort_order":"1"},{"id":"3","genre_name":"Mystery","sort_order":"2"}]}

    The script that call the dataset looks like this:

    <script>
    Ext.onReady(function(){
    Ext.BLANK_IMAGE_URL = '../images/s.gif';

    var genres = new Ext.data.Store({
    reader: new Ext.data.JsonReader({
    fields: ['id', 'genre_name'],
    root: 'rows'
    }),
    proxy: new Ext.data.HttpProxy({
    url: 'data/chap3PHPformatedData.cfm'
    }),
    autoLoad: true
    });
    //genres.load();


    new Ext.FormPanel({
    url: 'movie-form-submit.cfm',
    renderTo: document.body,
    frame: true,
    title: 'Movie Information Form',
    width: 250,
    items: [{
    xtype: 'combo',
    name: 'genre',
    fieldLabel: 'Genre',
    mode: 'local',
    store: genres,
    displayField:'genre',
    valueField: 'id',
    width: 130,
    triggerAction: 'all',
    emptyText: 'Select a state...'
    }]
    });
    });
    </script>

    The Ajax call seems to work and I can view the response text in firebug, but the combo box does not populate the drop down options.


    Thank you for your help.
    Steven Benjamin

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,891
    Vote Rating
    89
      0  

    Default

    Code:
    displayField:'genre',
    and

    Code:
    fields: ['id', 'genre_name'],

  3. #3
    Sencha User StevenInc's Avatar
    Join Date
    Jul 2009
    Location
    San Francisco
    Posts
    75
    Vote Rating
    0
      0  

    Default Thank you.

    That was the problem

Posting Permissions

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