Announcement

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

    Column resizing question

    Hello,

    I'm trying to figure out how to change some column display behavior. Here is an example of behavior we want to change:

    http://www.smartclient.com/#columnOrder

    Use this code:
    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:1000, height:224, alternateRecordStyles:true,
        data: countryData,
        fields:[
            {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},
            {name:"countryName", title:"Country"},
            {name:"capital", width:50,title:"Capital", showIf:"false"},
            {name:"continent", title:"Continent"}
        ],
        canReorderFields: true
    })
    
    
    isc.IButton.create({
        left:0, top:240,
        title:"Show Capitals",
        click:"countryList.showField('capital')"
    })
    
    isc.IButton.create({
        left:120, top:240,
        title:"Hide Capitals",
        click:"countryList.hideField('capital')"
    })

    1. Try it
    2. Resize the Country column so that it is as small as possible without clipping any of the text.
    3. Right-click Column headers > column > Capital

    When Capital is shown, you'll notice the Continent column is automatically expanding and changes width to consume all of the extra space in the grid. How do we configure this grid to not resize the Continent column in response to showing the Capital column?

    #2
    There is no explicitly width specified for the continent column, which means it fills the available space (similar to if it had had width specified as "*". This is also true for the country field.
    When the user resizes the country field, they are supplying an explicit width for it. The continent column's size remains constant at this point as we don't expand it in realtime while the user resizes (doing so leads to a very confusing user experience), but it still doesn't have an explicitly specified width.

    Then when a new field is shown (or the width of the grid as a whole changes, etc), the available space is recalculated, and the field is resized to fit it again.

    To suppress this behavior you basically need to supply an explicit width to the continent field. You could do this in the configuration for the grid when initializing it, or you could potentially use setWidth() at runtime at some point after the initial render.

    Regards
    Isomorphic Software

    Comment

    Working...
    X