PDA

View Full Version : sizing columns in a data grid???


jonesey
03-27-2003, 05:37 AM
Hi everyone,

First visit to this forum, so I hope I'm posting in the right place

I'm wondering why this won't work

function createList1() {
enquiryList_cp.setSize(450, 300);
enquiryList_cp.setColumns("Cat", "Qnty", "Price", "Description");
Cat.setWidth(20);
Qnty.setWidth(30);
Price.setWidth(60);
}

When the function is called the dataGrid appears at the correct size but the columns don't change.

I've tried,
with(enquiryList_cp){
Cat.setWidth(20);
}
tried,
enquiryList_cp.Cat.setWidth(20);

Any ideas would be appreciated

Thanks

jonesey

bluegel
03-27-2003, 10:29 AM
have you tried:

Cat._width = 20; etc

If this doesn't work, you could always upload a sample file to be looked at!

let us know how you get on!

thanx

jonesey
03-31-2003, 01:34 PM
thnx gel, I finally came up with a solution

function createList1() {
enquiryList_cp.setSize(450, 300);
enquiryList_cp.setColumns("Cat", "Qnty", "Price", "Description");
var col1 = enquiryList_cp.getColumnIndex("Cat");
enquiryList_cp.getColumnAt(col1).setWidth(40);
var col2 = enquiryList_cp.getColumnIndex("Qnty");
enquiryList_cp.getColumnAt(col2).setWidth(40);
var col3 = enquiryList_cp.getColumnIndex("Price");
enquiryList_cp.getColumnAt(col3).setWidth(70);
//no need to set width for last column
enquiryList_cp.setSortableColumns(false);
}

hope this helps anyone else with a similar problems