I've got a Grid whose GridItems contain another DataGrids. (= the DataGrid are nested in the Grid). Now I changed the Grid's horizontalGap-StyleProperty to zero. But because there are several DataGrids in one GridItem, there is still about 5-10px spacing in between those DataGrids开发者_JAVA技巧.
How to get rid of these spacings ? Thx
You can't it's not natively build in
try removing the padding on the DataGrids
Here an picture of the problem. linkToImage
The DataGrid-Items(white) measure 1/3 of the width of the GridItem, in which they are in. You can see the spacing in between the dataGrids and how it affects(dark-brown) the Grid. There should no spacing in between the dataGrids…
And here would be a minimalistic code example of my problem:
var grid:Grid = new Grid();
var gridRow:GridRow = new GridRow();
var gridItem:GridItem = new GridItem();
// the DataGrid which will be nested into the grid
var dataGrid:DataGrid = new DataGrid();
var item1:String = “exampleItem1”;
var dataGridColumnArray:Array = new Array();
var obj1:Object = {dItem:item1};
var objArray:Array = new Array();
objArray.push(obj1)
dataGridColumn.dataField = “dItem”;
dataGriColumnArray.push(dataGridColumn);
dataGrid.dataProvider = objArray;
dataGrid.columns = dataGriColumnArray;
//No spacing in the Grid
grid.setStyle(“horizontalGap”, 0);
//Nesting the DataGrid into the Grid
gridItem.addChild(dataGrid);
gridRow.addChild(gridItem);
grid.addChild(gridRow);
In this example there is just one DataGrid nested into the Grid. Originally I have at least three of them, and there is still spacing in between those.
Thanks a lot
Use an HBox and set the gap to 0 (or 1 for a small gap)
Put the datagrids inside the Hbox and set the horizontalGap for Hbox as 0. This will fix the issue.
精彩评论