PDA

View Full Version : ModelData bug?



danutzdobrescu
28 May 2009, 1:03 AM
Hi.. i've got a simple problem..

I've got this modeltype:


ModelType type = new ModelType();
type.root = "root";
type.recordName = "item";
type.addField("term");
type.addField("counter");


and i'm trying to change the format of the results displayed in a autocomplete combobox..



this.getSearchTerms().getView().setModelProcessor(new ModelProcessor<ModelData>(){

@Override
public ModelData prepareData(ModelData model)
{
if (model!=null)
{

String custom ="<table><tr><td>"+model.get("term")+""+"</td> <td style='align:right'><b>searched "+model.get("counter")+" times"+"</b></td></tr></table>";

System.out.println(custom);
model.set("customView",custom);
}
else
model.set("customView", model.get("term"));
return model;
}

});
this.getSearchTerms().getPropertyEditor().setDisplayProperty("customView");



no autocomplete is shown.. :(

but if i change this row

String custom ="<table><tr><td>"+model.get("term")+""+"</td> <td style='align:right'><b>searched "+model.get("counter")+" times"+"</b></td></tr></table>";

in
String custom =model.get("term")+"<table><tr><td>"+model.get("term")+""+"</td> <td style='align:right'><b>searched "+model.get("counter")+" times"+"</b></td></tr></table>";


everything is ok, except the fact that i've got this at the beggining model.get("term"). i want just a table with 2 columns.

It's a bug, or what?