$("#browserWarning").show();
}
$(".chzn-select, .enhance").as(Chosen).chosen();
$("#allowSingleDeselect").as(Chosen).chosen(new ChosenOptions().setAllowSingleDeselect(true));
$("#disableSearchThreshold").as(Chosen).chosen(
new ChosenOptions().setDisableSearchThreshold(10));
$("#searchContains").as(Chosen).chosen(
new ChosenOptions().setSearchContains(true));
$("#singleBackstrokeDelete").as(Chosen).chosen(
new ChosenOptions().setSingleBackstrokeDelete(true));
$("#maxSelectedOptions").as(Chosen).chosen(
new ChosenOptions().setMaxSelectedOptions(5));
$("#noResultsText").as(Chosen).chosen(
new ChosenOptions().setNoResultsText("Ooops, nothing was found:"));
final ChosenListBox chzn = new ChosenListBox();
chzn.addItem("item 1");
chzn.setWidth("250px");
RootPanel.get("updateChozen").add(chzn);
$("#updateButton").click(new Function() {
int i = 2;
@Override
public void f() {
for (int j = 0; j < 100; j++) {
chzn.addItem("item " + i);
i++;
}
chzn.update();
}
});
final ChosenListBox hcs = new ChosenListBox();
hcs.setWidth("350px");
hcs.setPlaceholderText("Navigate to...");
hcs.setTabIndex(9);
hcs.addItem("");
hcs.addStyledItem("Home", "home", null);
hcs.addGroup("ABOUT US");
hcs.addStyledItemToGroup("Press Releases", "press", null, 0);
hcs.addStyledItemToGroup("Contact Us", "about", null, 0);
hcs.addGroup("PRODUCTS");
hcs.addStyledItemToGroup("Tera-Magic", "tm", null, 0, 1);
hcs.addStyledItemToGroup("Tera-Magic Pro", "tmpro", null, 1, 1);
// Will be inserted before "Tera-Magic Pro" and custom-styled
hcs.insertStyledItemToGroup("Tera-Magic Standard", "tmstd", "youAreHere", 1, 1, 1);
RootPanel.get("hierChozenSingle").add(hcs);
// custom filter
ChosenOptions options = new ChosenOptions();
options.setResultFilter(new ServerSideSimulatorResultFilter());
final ChosenListBox serverChosenListBox = new ChosenListBox(false, options);
RootPanel.get("serverChozen").add(serverChosenListBox);
}