Environment:
Using SmartGWT3.1 on Eclipse Juno.
Problem:
I´m trying to show a data table on a TreeGrid view. The key point is that my data structure is like the figure Table.jpg attached (a print copy of MySql wokbench).
The columns are identified at first line, as follows:
Cloumn #1 = "codigo" is the unique primaryKey
almost all other columns are basically references to foreign keys.
The hierarchy relationship is among field "subCatego" (6th column at picture) and "alinea" (9th column).
I could make it present the root level as at attached figure tree_1.jpg. But when selecting any value the TreeGrid is updated and the selected item is removed from it, in opossite as expected to present its chield records.
I can trace the full cycle with fetching database and so on, and see that it returns at least 2 chield records for the first option ("1900000-OUTRAS RECEITAS...")
Here is the DS XML definition I´m using:
Since my data structure is not exactly as "parent-linked" I´m using DMI to manage it as recommended at Interface TreeDataBinding documentation. The logic in my DMI is pretty simple:
1- for any fetch request it gets the "subCatego" value from parentNode,
2- updates DSRequest including this "subCatego" as criteria
3- and fetchs the database.
obs- I´m also using embedded joins to retrieve some additional text. For example the text "190000-OUTRAS RECEITAS..." comes from foreign table.
Since my data is not "parent-linked" it sounds me the proper mode to use would be "CHILDREN". Could you please confirm if it´s correct and also please provide some hints on how to set it on the TreeGrid instance.
appreciate by your support
Conejo
Using SmartGWT3.1 on Eclipse Juno.
Problem:
I´m trying to show a data table on a TreeGrid view. The key point is that my data structure is like the figure Table.jpg attached (a print copy of MySql wokbench).
The columns are identified at first line, as follows:
Cloumn #1 = "codigo" is the unique primaryKey
almost all other columns are basically references to foreign keys.
The hierarchy relationship is among field "subCatego" (6th column at picture) and "alinea" (9th column).
I could make it present the root level as at attached figure tree_1.jpg. But when selecting any value the TreeGrid is updated and the selected item is removed from it, in opossite as expected to present its chield records.
I can trace the full cycle with fetching database and so on, and see that it returns at least 2 chield records for the first option ("1900000-OUTRAS RECEITAS...")
Here is the DS XML definition I´m using:
Code:
<fields> <field name="codigo" type="integer" primaryKey="true" hidden="true"></field> <field name="subCat" includeFrom="codigoTipoReceita_DS.nome" ></field> <field name="aln" includeFrom="classificacaoReceita_DS.nome" ></field> <field name="subCategoria" type="integer" foreignKey="codigoTipoReceita_DS.codigo" hidden="true"></field> <field name="alinea" type="integer" foreignKey="classificacaoReceita_DS.codigo" hidden="true" ></field> <field name="fonte" type="integer"></field> <field name="rubrica" type="integer"></field> <field name="prefeitura" type="integer" foreignKey="prefeituras.codigo" hidden="true"></field> <field name="orgao" type="integer" foreignKey="orgaos.codigo" hidden="true"></field> <field name="fonteRecurso" type="integer" foreignKey="codigoFonteRecurso_DS.codigo" hidden="true"></field> <field name="recurso" includeFrom="codigoFonteRecurso_DS.nome" hidden="true"></field> <field name="aplicacaoFixo" type="integer" foreignKey="codigoAplicacao_DS.codigoFico" hidden="true"></field> <field name="aplic" includeFrom="codigoAplicacao_DS.nome" hidden="true" ></field>
Since my data structure is not exactly as "parent-linked" I´m using DMI to manage it as recommended at Interface TreeDataBinding documentation. The logic in my DMI is pretty simple:
1- for any fetch request it gets the "subCatego" value from parentNode,
2- updates DSRequest including this "subCatego" as criteria
3- and fetchs the database.
obs- I´m also using embedded joins to retrieve some additional text. For example the text "190000-OUTRAS RECEITAS..." comes from foreign table.
Since my data is not "parent-linked" it sounds me the proper mode to use would be "CHILDREN". Could you please confirm if it´s correct and also please provide some hints on how to set it on the TreeGrid instance.
appreciate by your support
Conejo
Comment