Results 1 to 5 of 5

Thread: How to use a JSON Store with the itemselector

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    216

    Default How to use a JSON Store with the itemselector

    Hi,

    I've just tried the example of the itemselector that works perfectly but when I try to replace the ArrayStore by a JsonStore, I can't retrieve my data...

    Here's my code:

    Code:
    var ds = new Ext.data.JsonStore({
                  totalProperty: 'DATASET',
                  root: 'ROWS',
                  url: '../components/JSONPreferences.cfc',
                  baseParams:
                  {
                   method: 'GetReferences',
                   returnFormat: 'JSON',
                  },
                  fields: ['value','reference']
      
     });
    Code:
    multiselects: [{
                            width: 250,
                            height: 200,
                            store: ds,
                            displayField: 'Reference',
                            valueField: 'Reference'
                        },
    Does anyone have already done this kind of thing?

    Thanks,

    Marxan

  2. #2
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    You specifed the fieldname as 'reference', but set it as 'Reference' in your displayField. JavaScript is case-sensitive.

  3. #3
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    216

    Default

    Thanks for your answer but it doesn't solved the problem.

    More info: in FireFox, I don't even see the JSON in firebug. It seems that my component is never called.

  4. #4
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    Have you autoLoad set to true, or are you calling ds.load()? If you're doing either of those, and nothing is being returned, then the issue is likely to be on your server.

  5. #5
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    216

    Default

    you are right, I forget to put the autoLoad, but even now when my Json store is created, nothing is displayed in the selector...

    I've found another way to do it but it's not really well built as I created an ArrayStore with a cfloop...

    Code:
     var ds = new Ext.data.ArrayStore({
           // data: [[123,'224758'],
           //     ['1', '221632'], ['2', '285609'], ['3', '284709'], ['4', '284569'], ['5', '257856'],
           //     ['6', '216100'], ['7', '248629'], ['8', '212008'], ['9', '215910']],
           data:[<cfloop query="qGetProjectsReference">
                       <cfset i = i + 1>
                    [#qGetProjectsReference.PROJECT_REF#, '#qGetProjectsReference.PROJECT_REF#']<cfif qGetProjectsReference.RecordCount neq i>,</cfif>
                   </cfloop> ],
            fields: ['value','text'],
            sortInfo: {
                field: 'value',
                direction: 'ASC'
            }
    But I'm sure there's is a better way to do that! Still searching....

Similar Threads

  1. DataView requires tpl, store and itemSelector configurations to be defined.
    By dbottillo in forum Sencha Touch 1.x: Discussion
    Replies: 19
    Last Post: 25 Nov 2011, 3:40 AM
  2. Itemselector: issue with store.loadData - one character per line
    By benmclendon in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 16 Feb 2011, 10:41 AM
  3. Loading Data into Itemselector using json php
    By murkrishna in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 10 Oct 2010, 4:51 PM
  4. Problem with Drag&Drop with ItemSelector and Remote Store
    By caltheon in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 18 Jun 2010, 11:55 AM

Posting Permissions

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