PDA

View Full Version : Sub-Categories in a paginated ComboBox<Model>



DaRkViDe
21 Dec 2010, 7:36 AM
Hi, is it possible to separate in sub-categories the items of a paginated combobox mantaining the correct pagination?

I tried to apply a tamplate to the combobox using a property of my modeldata like:

combo.setSimpleTemplate("<b>{brand}<b> - {model}");

and it works fine but in this case the String of brand is repeated for all rows like:

Brand1 - Model1
Brand1 - Model2
Brand1 - Model3
Brand1 - Model4
Brand1 - Model5

The effect instead i want is:

Brand1
Model1
Model2
Model3
Model4
Model5
Brand2
Model1
Model2
Model3
Model4
Model5

Is it possible to paginate it mantaining the entries ordered by brand?? is there some post that talks about it?

Help thanks

sven
21 Dec 2010, 7:43 AM
There is nothing implemented for this, but possible. I already did this for one of my clients. I dont know of any forum thread that says how to do it.

DaRkViDe
3 Jan 2011, 4:05 AM
hi, i've created a method to show a sub categories on a combo like above;
Now i want to apply a bolt style to the category root with a template if a property of a model is ==-1!
The template applied is:


private native String getTemplate2()/*-{

return [
' <tpl for=".">'+
'<tpl if="id_record == -1 "><b>{entry}</b></tpl>' +
'<tpl if="id_record != -1 ">&nbsp;&nbsp;&nbsp;&nbsp;{entry}</tpl>'
+'</tpl>'
].join("");
}-*/;

But this tabplate cycles on all items of the store appling it on a single row...

I tried to use this without a for cycle but i get an error like "id_record was not defined":

private native String getTemplate2()/*-{

return [
'<tpl if="id_record == -1 "><b>{entry}</b></tpl>' +
'<tpl if="id_record != -1 ">&nbsp;&nbsp;&nbsp;&nbsp;{entry}</tpl>'

].join("");
}-*/;

The model data i'm using contain only an integer ("id_record") and a string ("entry");


class MyModel extends BaseModel implements Serializable{
public MyModel(int id_record,String entry) {
set("id_record", id_record);
set("entry", entry);
}
}

anyone helps??

DaRkViDe
3 Jan 2011, 5:26 AM
no one? :(