0

problem listbox index can't reload properly after addnew and remove data.??

asked 2013-04-16 05:08:37 +0800

argan gravatar image argan
9

updated 2013-04-16 06:10:37 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

i have a case make listbox by itemrender and listmodellist, i intended want to remove item in listitem but the index in listbox is not reload properly also while i adding new item to listbox the index is not reloaded properly, please help me.? regard Argan,

this an example code :

this is existing data

final String[] pic = selectBuyer.getPic().split(";", 8);
final String pichp[] = selectBuyer.getPichp().split(";", 8);
final String picGabungan[][];

            if (pic.length == 1) {
                picGabungan = new String[1][2];
                picGabungan[0][0] = pic[0];
                picGabungan[0][1] = pichp[0];
            } else {
                picGabungan = new String[pic.length][pichp.length];
                for (int i = 0; i < pic.length; i++) {
                    picGabungan[i][0] = pic[i];
                    picGabungan[i][1] = pichp[i];
                }
            }
            if (picGabungan != null || picGabungan == null) {
                listbox = (Listbox) view.getFellow("win").getFellow("listbox",
                        true);
                listbox.setModel(new ListModelList(picGabungan));
                listbox.setItemRenderer(new ListitemRenderer() {
@Override

public void render(final Listitem li, Object data, int indexArg) throws Exception {


btnSave1.addEventListener("onClick",new EventListener<Event>() {

public void onEvent(Event arg0)throws Exception {

String[] b = new String[2];

b[0] = txtPic.getValue();

b[1] = txtPichp.getValue();

((ListModelList) listbox.getModel()).set(indexNya, b);

// here is problem that index can't reloaded properly.??

}

    });

btnDelete.addEventListener("onClick", new EventListener() {

@Override

public void onEvent(Event arg0)throws Exception {

((ListModelList) listbox.getModel()).remove(indexNya);
// here is problem that index can't reloaded properly.??


}

});

}


});

please any body help me.???

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-06-24 21:25:08 +0800

WilliamB gravatar image WilliamB
1609 1 6

Same issue with Tabbox & Model, when i remove an item the index of the element afterward doesn't get updated and i end up with nullpointer and stuff

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-04-16 05:08:37 +0800

Seen: 28 times

Last updated: Jun 24 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More