Re: select2 integration -Duplicate(selected) value are appear in drop down box

2012-12-03 Thread Thomas Götz
I can't detect anything wrong with your implementation on first sight. Is it 
possible that you can reproduce the described behavior in a Quickstart?

  -Tom


On 01.12.2012, at 03:09, Madasamy mcruncher madas...@mcruncher.com wrote:

 FooProvider implementation is
 
public class FooProvider extends TextChoiceProviderFoo
{
 
   FooService fooService=new FooService();
   @Override
protected String getDisplayText(Foo fooChoice) {
return fooChoice.getName();
}
 
@Override
protected Object getId(Foo fooChoice) {
return fooChoice.getName;
}
 
@Override
public void query(String term, int page, ResponseFoo response) {
response.addAll(queryMatches(term, page, 10));
response.setHasMore(response.size() == 10);
 
}
 
@Override
public CollectionFoo toChoices(CollectionString ids) {
ArrayListFoo foos = new ArrayListFoo();
for (String id : ids) {
foos.add(fooService.findFooByName(id));
}
return foos;
}
}
 
 private ListFoo queryMatches(String term, int page, int pageSize) {
 
ListFoo result = new ArrayListFoo();
term = term.toUpperCase();
final int offset = page * pageSize;
int matched = 0;
for ( Foo foo : getAllFoos()) {
if (result.size() == pageSize) {
break;
}
 
if (foo.getName().toUpperCase().contains(term)) {
matched++;
if (matched  offset) {
result.add(foo);
}
}
}
return result;
}
 
public ListFoo getAllFoos()
{
//return all foos
return fooService.findAll();
}


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: select2 integration -Duplicate(selected) value are appear in drop down box

2012-11-30 Thread Madasamy mcruncher
FooProvider implementation is

public class FooProvider extends TextChoiceProviderFoo
{

   FooService fooService=new FooService();
   @Override
protected String getDisplayText(Foo fooChoice) {
return fooChoice.getName();
}

@Override
protected Object getId(Foo fooChoice) {
return fooChoice.getName;
}

@Override
public void query(String term, int page, ResponseFoo response) {
response.addAll(queryMatches(term, page, 10));
response.setHasMore(response.size() == 10);

}

@Override
public CollectionFoo toChoices(CollectionString ids) {
ArrayListFoo foos = new ArrayListFoo();
for (String id : ids) {
foos.add(fooService.findFooByName(id));
}
return foos;
}
}

 private ListFoo queryMatches(String term, int page, int pageSize) {

ListFoo result = new ArrayListFoo();
term = term.toUpperCase();
final int offset = page * pageSize;
int matched = 0;
for ( Foo foo : getAllFoos()) {
if (result.size() == pageSize) {
break;
}

if (foo.getName().toUpperCase().contains(term)) {
matched++;
if (matched  offset) {
result.add(foo);
}
}
}
return result;
}

public ListFoo getAllFoos()
{
//return all foos
return fooService.findAll();
}


select2 integration -Duplicate(selected) value are appear in drop down box

2012-11-29 Thread Madasamy mcruncher
we are using select2 version 2.0  in our application.
Select2MultiChoice field are using for select a multiple value. here we set
the
maximumselectionsize is 20. and set minimuminputlength is 1.when we
give input in that field the relevant value are appear in drop down box
correctly,
if selection count reach  15 or 16, hence we give input in that field the
duplicated
(selected) value are appear in the drop down box.

but i could not recreate this problem in Myquickstart.

the sample code is

Select2MultiChoiceFoo fooField = new
Select2MultiChoiceFoo(message,
  new PropertyModelCollectionFoo(this, foo), new
FooProvider);
fooField.getSettings().setMinimumInputLength(1);
fooField.getSettings().setMaximumSelectionSize(20);
fooField.setRequired(true);
return fooField;


Re: select2 integration -Duplicate(selected) value are appear in drop down box

2012-11-29 Thread Thomas Götz
Can you please post your FooProvider implementation?

   -Tom

On 30.11.2012, at 05:31, Madasamy mcruncher madas...@mcruncher.com wrote:

 we are using select2 version 2.0  in our application.
 Select2MultiChoice field are using for select a multiple value. here we set
 the
 maximumselectionsize is 20. and set minimuminputlength is 1.when we
 give input in that field the relevant value are appear in drop down box
 correctly,
 if selection count reach  15 or 16, hence we give input in that field the
 duplicated
 (selected) value are appear in the drop down box.
 
 but i could not recreate this problem in Myquickstart.
 
 the sample code is
 
Select2MultiChoiceFoo fooField = new
 Select2MultiChoiceFoo(message,
  new PropertyModelCollectionFoo(this, foo), new
 FooProvider);
fooField.getSettings().setMinimumInputLength(1);
fooField.getSettings().setMaximumSelectionSize(20);
fooField.setRequired(true);
return fooField;


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org