flex - Deep Nested XML -
I am trying to display a list of items in the datagrid from XMLList.
& lt; Chain no = "1" & gt; & Lt; File & gt; & Lt; Filenum & gt; 1 & lt; / Epnum & gt; & Lt; Prodnum & gt; 4V01 & lt; / Prodnum & gt; & Lt; Title & gt; Series # 1 - File # 1 & lt; / Title & gt; & Lt; / File & gt; & Lt; File & gt; & Lt; Filenum & gt; 2 & lt; / Epnum & gt; & Lt; Prodnum & gt; 4V02 & lt; / Prodnum & gt; & Lt; Title & gt; Series # 1 - File # 2 & lt; / Title & gt; & Lt; / File & gt; & Lt; / Series & gt; & Lt; Series no = "2" & gt; & Lt; File & gt; & Lt; Filenum & gt; 1 & lt; / Epnum & gt; & Lt; Prodnum & gt; 4V01 & lt; / Prodnum & gt; & Lt; Title & gt; Series # 2 - File # 1 & lt; / Title & gt; & Lt; / File & gt; & Lt; File & gt; & Lt; Filenum & gt; 2 & lt; / Epnum & gt; & Lt; Prodnum & gt; 4V02 & lt; / Prodnum & gt; & Lt; Title & gt; Series # 2 - File # 2 & lt; / Title & gt; & Lt; / File & gt; & Lt; / Series & gt;
My current code allows me to retrieve every series in an XMLList and then I have a Nested Grid Class which allows me to do something.
& lt; Classes: NestedDataGrid width = "100%" height = "100%" id = "grid files" dataprider = "{file list}" & gt; & Lt; Classes: Columns & gt; & Lt; Mx: DataGridColumn headerText = "Season" datafile = "@n" width = "60" /> & Lt; Mx: DataGridColumn headerText = "episode" dataField = "file.filenum" width = "60" /> & Lt; Mx: Data Grid Column Title Title = "Title" DataFilld = "File Title" /> & Lt; / Classes: column & gt; & Lt; / Classes: NestedDataGrid & gt;
Although it displays the data grid with two lines, 1 in the series column in the first row and then two files are sorted into another cell in the same row. The second line is the same, but the number two and two series # 2 files in the series column come in the cell located next to it.
If I do not use nested data classes, then instead I have the list of files that use Series. Files and all 4 files is correct, although I did not get the serial number for each ... < /p>
With the current structure of XML, it is easy to represent with two column grids - the first column series The number is, and the second column is the second 2 or 3 column datagrid which is Displays the file details. But if you do not want to change the structure, then the following code is what you need. Note that since the dataField
property is not set, you must specify sortCompareFunction
to sort the grid by series number - otherwise try to sort This can be an exception when doing so.
& lt; Category: NestedDataGrid width = "100%" height = "100%" id = "gridfiles" dataprider = "{filesList.Series.file}" & gt; & Lt; Category: Columns> & Lt ;! - What are the sections that are copied with the code of OP? - & gt; & Lt; Mx: DataGridColumn headerText = "Season" labelfunction = "getSeries" width = "60" /> & Lt; Mx: DataGridColumn headerText = "episode" datafile = "filename" width = "60" /> & Lt; Mx: DataGrid column title title = "title" datafile = "title" /> & Lt; / Classes: column & gt; & Lt; / Classes: NestedDataGrid & gt; Private function getSeries (item: object, col: DataGridColumn): string {return XML (item). Parent (). @ No; }
UPDATE:
& lt; Mx: Data Grid Width = "100%" height = "100%" id = "Grid Files" & gt; ; & Lt; Mx: column & gt; & Lt; Mx: DataGridColumn headerText = "Season" labelfunction = "getSeries" width = "60" /> & Lt; Mx: DataGrid column heading = "episode" datafilled = "epinem" width = "60" /> & Lt; Mx: DataGrid column title title = "title" datafile = "title" /> & Lt; / Mx: column & gt; & Lt; / Mx: data grid & gt; GridFiles.dataProvider = XML (event.result) .descendants ('Episode'); Use the same getSeries function as above / /
Comments
Post a Comment