on ‎2006 Dec 07 2:17 PM
I am using 11.5 xMII, I have varying columns returned from a dynamic query in a iGrid, I am trying to set the headers in the Javascript. I tried both setColumnHeader and setColumnHeaders and it does not work. See my code below ...
var DataQryObj = document.getElementById('xxx').getQueryObject();
var DataDispObj = document.getElementById('xxx').getGridObject();
var colHeaders = '', colWidths = '';
DataQryObj.setParam(1,'a');
colHeaders = 'Year,Time Period,,';
colWidths = '10,10,0,0';
DataDispObj.setColumnHeadings(colHeaders); //THIS WORKS
DataDispObj.setColumnWidths(colWidths); //THIS WORKS
for(var i=5;i<DataDispObj.getColumnCount();i++) {
DataDispObj.setColumnWidth(i,0); //DOESNT WORK
DataDispObj.setColumnHeading(i,'XXXXX'); //DOESNT WORK
colHeaders = (',,''ZZZZZ');
colWidths += (',0,10');
}
DataDispObj.setColumnHeadings(colHeaders); //DOESNT WORK
DataDispObj.setColumnWidths(colWidths); //DOESNTWORK
Any help is appreciated.
thanks
Sreenivasa
Request clarification before answering.
And don't forget to updateGrid; see below:
var Customers = document.Customers;
var CustomersGrid = Customers.getGridObject();
var columnCount = CustomersGrid.getColumnCount();
CustomersGrid.setColumnHeadings("1,2,3,4,5,6");
Customers.updateGrid(true);
for (var i=0; i<columnCount; i++) {
alert(CustomersGrid.getColumnHeading(i));
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sreenivasa,
How many columns are there in your grid? In your for loop, you are starting the loop count "i" at 5. So if you only have 4 columns (DataDispObj.getColumnCount()), your loop won't run at all.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.