Hi all!
How can I create dynamic grid layout structure upon structure defined in database table?
for example:
1.) have a table A. In it are only table names of tables for which I want to make grids
2.) I want to take "show columns for chosen table" the column names and column data types and upon them dinamically create layout cell structure.
Bellow is example of hard coded layout structure from dojo grid test example. What I want is to dynamically fill the cell array of column structure from db table;
var gridLayout = [
{ type: "dojox.GridRowView", width: "20px" },
{ defaultCell: { width: 6, editor: dojox.grid.editors.Dijit },
cells: [[
{ name: 'Id', styles: 'text-align: right;', editorClass: "dijit.form.NumberTextBox" },
{ name: 'Name', width: 20},
{ name: 'Message', styles: 'text-align: right;'},
{ name: 'Date',
editor: mySqlDateEditor,
formatter: formatMySqlDate,
constraint: {selector: "date"},
width: 10,
styles: 'text-align:right;'}
]]
}
];
Thank you in Advance,
David

Nobody knows?
Nobody knows?
Well, a start would be
Well, a start would be something along these lines:
1. The layout is an array of objects. An array may be represented by []. For example,
var gridLayout = []; or var gridLayout = [{ type: "dojox.GridRowView", width: "20px" },{ defaultCell: { width: 6, editor: dojox.grid.editors.Dijit },cells: [[]]}];2. Each column is an object. An object may be represented by {}. For example,
var item = {}; item.name='id';item.styles='text-align: right;';item.editorClass='dijit.form.NumberTextBox'; var cells = gridLayout[2].cells; //the cells column layout is in the third element of your array. var cellsItems = cells[0]; //the array of items, within the 0th element in the cells array. cellsItems.push(item); //then loop, setting item, and pushing (adding) it to the cellsItems array.There may be a logic/typo error or few above, but the concept should work.