Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Multiple expand columns in custom ListGrid (bug)

    Hi,

    I made custom widget which inherits from ListGrid. In Class.addProperties() for the CustomListGrid class fields are defined and canExpandRecords is set to true.
    Now when more then one instance of custom grid is created column which holds expand buttons will multiply.

    Multiplication occurs in way: one additional column per instance.
    It means when two instances are created, the second has two expand columns. If three are created, the second will have two such columns and the 3rd instance will have three, and so on.

    Code sample:
    Code:
    ClassFactory.defineClass("CustomListGrid", ListGrid);
    
    CustomListGrid.addProperties({
        width:500, height:300,
        alternateRecordStyles:true,
        data: countryData,
        fields: [
            {name: "countryName", title: "Country"},
            {name: "capital", title: "Capital"},
            {name: "continent", title: "Continent"}
        ],
        canExpandRecords: true,
        expansionMode: "detailField",
        detailField: "background"
    });
    
    VLayout.create({
        ID: "multipleExpandColumnsBug",
        members: [
            CustomListGrid.create({ ID: "countryList1" }),
            CustomListGrid.create({ ID: "countryList2" })
        ]
    });
    
    isc.Page.setEvent("load", "multipleExpandColumnsBug.draw()");
    Country data was taken from SmartClient example but I've attached it to this post too with screen shot of the problem.

    Is this a bug or API misuse?

    ---
    SmartClient 8.0
    FireFox 3.6.17
    Attached Files

    #2
    In your addProperties() call, set defaultFields instead of fields

    Comment


      #3
      Sure :)

      Thank you.

      It would be good to point this out in documentation of ListGrid fields property (f.e. see also section).
      Last edited by topr; 3 Jun 2011, 02:09.

      Comment


        #4
        One more question:

        How can I use defaultFields with fields which are not defined in datasource.
        The exact use case is toolbar or header definition. It worked when was like this:
        Code:
        CustomDynamicForm.addProperties({
            fields: [
                { name: "someFieldExistingInDatasource" },
                { name: "toolbar", type: "toolbar" }
            ]
        })
        
        CustomDynamicForm.addMethods({
            getToolbar:function() {
                var toolbar = this.getField("toolbar");
                return toolbar;
            }
        })
        However when defaultFields are used instead fields property, method getToolbar() will return nothing.

        Comment

        Working...
        X