1. #1
    Ext JS Premium Member
    Join Date
    Nov 2008
    Location
    Warsaw area, Poland
    Posts
    64
    Vote Rating
    1
    nightwatch is on a distinguished road

      0  

    Default Lazy creation of ListView - what's wrong

    Lazy creation of ListView - what's wrong


    I'm using the following code to create a ListView with ArrayStore. The list view is created, but no data shows up (only column headers are visible). What's wrong?

    Code:
    {
      "height": 200,
      "title": "Moje zadania",
      "emptyText": "Brak zadań",
      "cls": "x-portlet",
      "xtype": "portlet",
      "items": [
        {
          "xtype": "listview",
          "columns": [
            {
              "dataIndex": "Id",
              "header": "Id"
            },
            {
              "dataIndex": "Title",
              "header": "Tytuł"
            },
            {
              "dataIndex": "AssigneeGroup",
              "header": "Grupa"
            },
            {
              "dataIndex": "CreatedDate",
              "header": "Utworzone"
            }
          ],
          "store": {
            "autoLoad": true,
            "xtype": "arraystore",
            "fields": [
              "Id",
              "Title",
              "AssigneeGroup",
              "CreatedDate"
            ],
            "data": [
              [
                "1",
                "Zadanie pierwsze",
                "I linia BO",
                "2008-05-12"
              ],
              [
                "2",
                "Zadanie czecie",
                "I linia BO",
                "2008-05-11"
              ],
              [
                "3",
                "Zadanie drugie?",
                "I linia BO",
                "2008-05-10"
              ]
            ]
          }
        }
      ]
    }

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,358
    Vote Rating
    127
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    A portlet is a container here holding items. What layout manager are you using?

    You should be using a fit layout for the portlet.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Ext JS Premium Member
    Join Date
    Nov 2008
    Location
    Warsaw area, Poland
    Posts
    64
    Vote Rating
    1
    nightwatch is on a distinguished road

      0  

    Default


    Yes, the ListView is inside a portlet - but this is not a problem. I'm using 'Portal' layout manager from one of extjs samples.
    Meanwhile, I think I have found the solution: the store for ListView will not be created automatically based on xtype: 'arraystore'. You have to create the store by calling the constructor. The code below works, but shouldn't it work also with lazy store creation?

    Code:
    {
      "height": 200,
      "title": "Moje zadania",
      "cls": "x-portlet",
      "xtype": "portlet",
      "items": [
        {
          "emptyText": "Brak zadań",
          "autoHeight": true,
          "xtype": "listview",
          "columns": [
            {
              "width": 0.15,
              "dataIndex": "Id",
              "header": "Id"
            },
            {
              "width": 0.45,
              "dataIndex": "Title",
              "header": "Tytuł"
            },
            {
              "width": 0.2,
              "dataIndex": "AssigneeGroup",
              "header": "Grupa"
            },
            {
              "dataIndex": "CreatedDate",
              "header": "Utworzone"
            }
          ],
          "store": new Ext.data.ArrayStore({"autoLoad":true,"xtype":"arraystore","fields":["Id","Title","AssigneeGroup","CreatedDate"],"data":[["1","Zadanie pierwsze","I linia BO","2008-05-12"],["2","Zadanie czecie","I linia BO","2008-05-11"],["3","Zadanie drugie?","I linia BO","2008-05-10"]]}
          )
        }
      ]
    }

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,358
    Vote Rating
    127
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Yes, it should. If you are able to replicate a simple example that reproduces this bug, please post it in the Bugs forum. A while back someone had reported that the lazy instantiation of stores was not working properly but we were unable to reproduce it.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 1