Hi there,
we have a problem with the ListGrid in the latest Smartclient 13-Build
We have used the fieldStateChanged when the viewState of the ListGrid changed, but this method contains no sort information. So we changed to the viewStateChanged which includes the sort information. We thought that the viewStateChanged behaves otherwise the same as fieldStateChanged. But with the viewStateChanged we have the problem that the resizing of the columns does not behave in the same way as fieldStateChanged. With the viewStateChanged only the width of the last adjusted column is passed to the viewState. The width of columns that have been modified before will not be passed to the viewStat.
Is there any possibility to get both information, the sort information and the resizing of the colums like in fieldStateChanged in the viewState?
Sidenote: We are removing the "selected" and "open" attributes from the viewstate.
Also we do calculate the absolute widths of the colums to a percentage-width for each field.
viewStateChanged -> only the last width but with sorting
fieldStateChanged -> no sorting but all widths
Best regards
we have a problem with the ListGrid in the latest Smartclient 13-Build
We have used the fieldStateChanged when the viewState of the ListGrid changed, but this method contains no sort information. So we changed to the viewStateChanged which includes the sort information. We thought that the viewStateChanged behaves otherwise the same as fieldStateChanged. But with the viewStateChanged we have the problem that the resizing of the columns does not behave in the same way as fieldStateChanged. With the viewStateChanged only the width of the last adjusted column is passed to the viewState. The width of columns that have been modified before will not be passed to the viewStat.
Is there any possibility to get both information, the sort information and the resizing of the colums like in fieldStateChanged in the viewState?
Sidenote: We are removing the "selected" and "open" attributes from the viewstate.
Also we do calculate the absolute widths of the colums to a percentage-width for each field.
Code:
function viewStateWithPercentageWidths(usePercentage, viewState, gridName) { var grid = isc.Canvas.getById(gridName); var gridWidth = grid.getWidth(); if (usePercentage) { viewState = viewState.replace(/\"width\":(\d*(\.\d*)?)/g, function (s, aWidth) { var percentageWidth = "\"width\":"; if (aWidth != "") { percentageWidth = percentageWidth + "\"" + ((parseInt(aWidth) / gridWidth) * 100) + "%\""; } return percentageWidth }); } else { viewState = viewState.replace(/\"width\":\"(\d*(\.\d*)?)\%\"/g, function (s, aWidth) { var realWidth = "\"width\":"; if (aWidth != "") { realWidth = realWidth + Math.ceil((parseFloat(aWidth) * gridWidth) / 100) } return realWidth }); viewState = "(" + viewState + ")" }; return viewState }
Code:
viewState: { "field":[ { "name":"fieldOne", "autoFitWidth":false }, { "name":"fieldTwo", "autoFitWidth":false }, { "name":"fieldThree", "autoFitWidth":false, "width":"43.10776942355889%" } ], "sort":{ "sortSpecifiers":[ { "property":"fieldOne", "direction":"ascending" } ] }, "hilite":"[No Hilites]", "group":"[No Grouping]", "showFilterEditor":false }
Code:
viewState: { "field":[ { "name":"fieldOne", "autoFitWidth":false, "width":"4.385964912280701%" }, { "name":"fieldTwo", "autoFitWidth":false, "width":"34.08521303258145%" }, { "name":"fieldThree", "autoFitWidth":false, "width":"34.21052631578947%" } ], "sort":"[No Sorting],"hilite":"[ No Hilites ]","group":"[ No Grouping ]","showFilterEditor":false}
Comment