:: Forum >> Version 2 >>

CheckedList with default value

Hello, Iīm use a checkedlist and I want to display the items of this checked by default. I try this:

var vect = new Array();

var j=0;
for (j = 0; j < tablaClientes.getCount(); j++){
vect.push(tablaClientes.getData(2,j));
}
//vect has 6 items
chlbClientes.setItemValue(["true","true","true","true","true","true"]);
chlbClientes.setItemText(vect);
chlbClientes.setItemCount(vect.length);
document.write(chlbClientes);

But this data source donīt put items with checked value by default, how can I put the default item value? I want to display checkedlist items with checked value by default.
Thanks.
Tecnora
Thursday, April 17, 2008
Your method will work if you use normal list with checkbox template -

var obj = new AW.UI.List;
obj.setItemTemplate(new AW.Templates.Checkbox);

obj.setItemText("item");
obj.setItemValue([truefalsetrue]);
obj.setItemCount(3);

document.write(obj);
 
If you want to use CheckedList control - use selectedItems property to set/clear checkboxes -

var obj = new AW.UI.CheckedList;

obj.setItemText("item");
obj.setItemCount(3);

obj.setSelectedItems([02]);

document.write(obj);
 
Alex (ActiveWidgets)
Thursday, April 17, 2008
ok, thanks Alex, It works fine
Tecnora
Friday, April 18, 2008



This topic is archived.

Back to support forum

Forum search