Announcement

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

    Wrong width when adding members to a layout

    Hey guys, found a bug when working with layouts and adding members to them.

    In detail I built a layout and initially filled it with a tree grid with a fixed width of 200. Afterwards I add a new list grid with a width of 100% via addMember(listGrid, 1) to the layout. When this happens, I also ask the new list grid for its width. And here is the issue:
    Instead of answering the real width (100% - 200px), the list grid answers the total width of the layout.
    This seems only to happen when asking for the width after the initialization. When asking for it afterwards (e.g. by an event e.g. the button) it is answered correctly.

    Following a small example for reproduce the bug:

    Code:
    isc.HLayout.create({
    	"ID" : "layout",
    	"width" : "100%",
    	"members" : [
    		isc.TreeGrid.create({
    			"width" : 200
    		})
    	]
    }),
    
    layout.addMember(
    	isc.ListGrid.create({
    		"ID" : "listGrid",
    		"width" : "100%"
    	}), 1),
    	
    isc.say("initial width of listgrid: " + listGrid.width);
    isc.Button.create({
    	left : 500,
    	top : 280,
    	"action" : function () {
    		isc.say("width of listgrid: " + listGrid.width);
    	},
    	width : 200,
    	"title" : "whats the widht of listgrid now?"
    })
    This issue occurred in the latest versions of Firefox, Chrome and IE as well as the latest nighly build of smartclient (Jan 13th 2015)

    Best Regards

    #2
    Accessing listGrid.width is invalid - use an actual API such as getWidth() or getVisibleWidth().

    layout.addMember() does not synchronously draw the newly added member until you tell the layout to do so by calling reflowNow(). See the docs of that method for details.

    Comment

    Working...
    X