0

Repopulate data to Listbox works fine in Firefox3.6 but not in IE7

asked 2010-07-28 13:57:12 +0800

zknewbie1 gravatar image zknewbie1
370 4

updated 2010-07-28 15:16:18 +0800

Hi, I have a Listbox that allows multiple record selection to be selected and verified; and a Button to carry out the verification action. After that, the Listbox is refreshed so that it won't display those selected records anymore (ex: if there're 10 records and 3 are selected for verification, once the Verification button is clicked, the Listbox will only display 7 records now). The problem is that it works fine in Firefox3.6 but errors out in IE7 with this error: "Failed to process addAft, Object doesn't support this property or method". The Verification logic for my Button is as follow:
1. Run an Update Query to change the Verify field from 'unverified' to 'verified' for those selected records.
2. Run a Select Query to grab only those with Verify = 'unverified' (so that the new ResultSet won't include those records that just got verified)
3. SetModel and ItemRenderer to the List<RecordBean> in step 2.

Please let me know why it does not work in IE7? I'm using ZK 5.0.3 Community Edition. Thanks much..

delete flag offensive retag edit

13 Replies

Sort by ยป oldest newest

answered 2010-07-28 20:50:54 +0800

PeterKuo gravatar image PeterKuo
481 2

It looks much like a bug.

Would you post your sample code.
That can help us to identify the problem.

If you prepare two set of model,
and set model1 first, and then click a button to set model2,
does the problem still happen?

link publish delete flag offensive edit

answered 2010-07-29 08:53:44 +0800

zknewbie1 gravatar image zknewbie1
370 4

Hi Peter, the setModel is wrapped in a private method, so basically it's a separate instantiation each time I render. It consistently works fine in Firefox and consistently errors out in IE7??

Ex: the method call:

this.renderListBox(this.getVerifyBaseLst(),
                              verifyBaseListBox,
                              new EntityBeanVerifyBaseItemRenderer());


the method:
private void renderListBox(List theDataList,
                                         Listbox theListBox,
                                         ListitemRenderer theRenderer) {
    ListModel listModel = new SimpleListModel(theDataList);
    theListBox.setModel(listModel);
    theListBox.setItemRenderer(theRenderer);
}//end method

link publish delete flag offensive edit

answered 2010-07-29 19:42:56 +0800

PeterKuo gravatar image PeterKuo
481 2

You may reorder the sequence and give it a try.
theListBox.setItemRenderer(theRenderer);
theListBox.setModel(listModel);

link publish delete flag offensive edit

answered 2010-07-30 07:57:57 +0800

zknewbie1 gravatar image zknewbie1
370 4

I just tried your suggestion and still no luck..

link publish delete flag offensive edit

answered 2010-08-02 13:19:42 +0800

zknewbie1 gravatar image zknewbie1
370 4

I just downloaded Google Chrome 5.0. and it runs just fine like Firefox3.6. Must be something particular to IE7 that makes it errors out..

link publish delete flag offensive edit

answered 2010-08-03 05:59:18 +0800

PeterKuo gravatar image PeterKuo
481 2

@zknewbie1
It seems much like a bug.
Would you post it to bug and let us track it there.

It would help a lot if you can provide simple code that can reproduce the problem.

link publish delete flag offensive edit

answered 2010-08-03 15:20:05 +0800

zknewbie1 gravatar image zknewbie1
370 4

Hi Peter, I fixed the problem, it's a very weird one though: all I have to fix is to comment out the Messagebox.show(), which is the last line of code at the end of the event-handler method like below. Do you have any documentation on the error: "Failed to process addAft, Object doesn't support this property or method"? This is particular to IE7 problem. Firefox and Chrome work just fine. Also, I tried to post this issue to Bugs but it asked me for a Sourceforge login??

/** Simulate some change to the dataset and then reload data to Listbox */
  public void processLstBoxBtn_onClick() throws Exception {
    Listbox theListBox = (Listbox) getFellow("lstBox");
    if (theListBox.getSelectedItems().isEmpty()) {
      Messagebox.show("Please select some records first.");
    }//if user has not selected any record
    else {
      List<String> modifiedList = new ArrayList();
      String strHolder = "";
      for (Object item: theListBox.getSelectedItems()) {
        Listitem listItem = (Listitem) item;  
        String itemValue = (String) listItem.getValue();
        strHolder += itemValue + "\n";
        modifiedList.add(itemValue);
      }//end for
      this.setTheList(modifiedList);
      // Populate the new dataset to the Listbox
      zkCommonUtils.renderListBox(this.getTheList(), theListBox, new LocalItemRenderer());
      //NOTE: somehow in IE7, a nasty error return when I call Messagebox.show()
      //  right after re-rendering the Listbox; the error says:
      //  "Failed to process addAft, Object doesn't support this property or method"
      //   have to comment it out for now; Firfox3.6 and Chrome5.0 do not have
      //   this issue!
      //Messagebox.show("The Listbox has been re-rendered: " + strHolder);
    }//end if some records were selected
  }//end method

link publish delete flag offensive edit

answered 2010-08-03 15:29:09 +0800

zknewbie1 gravatar image zknewbie1
370 4

Hi Peter, could you also take a look at my other question: "Print out data in Landscape format and Auto-fit". I posted this question about a week ago but still no luck. Sorry if it sounds like a stupid question because I'm still new to ZK. It's very good framework though. Thanks.

link publish delete flag offensive edit

answered 2010-08-03 20:27:48 +0800

PeterKuo gravatar image PeterKuo
481 2

@zknewbie1
Because we use sourceforge to track the bug. So you must login to post a bug.

link publish delete flag offensive edit

answered 2010-08-03 21:18:25 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi zknewbie1
I have created a sample for reproduce your problem
but it worked well with latest ZK freshly and ZK 5.0.3 official

<zk>
	<zscript><![CDATA[
		ArrayList datas = new ArrayList();
		for(int i = 0; i < 100;i ++)
			datas.add("item "+ i );
		
		ListitemRenderer renderer = new ListitemRenderer(){
			public void render(Listitem item, Object data) throws Exception {
				item.appendChild(new Listcell(String.valueOf(data)+0));
				item.appendChild(new Listcell(String.valueOf(data)+1));
				item.setValue(data);
			}
		};
		SimpleListModel lm = new SimpleListModel(datas);
	]]></zscript>
	<listbox id="listbox" itemRenderer="${renderer}" model="${lm}" width="200px" height="200px" multiple="true"/>
	<button label="update model">
		<attribute name="onClick"><![CDATA[
			datas = new ArrayList();
			for(Object obj: listbox.getSelectedItems()){
				Listitem item = (Listitem) obj;
				datas.add(item.getValue());
			}
			
			listbox.setItemRenderer(new ListitemRenderer(){
				public void render(Listitem item, Object data) throws Exception {
					item.appendChild(new Listcell(String.valueOf(data)+0));
					item.appendChild(new Listcell(String.valueOf(data)+1));
					item.setValue(data);
				}
			});
			
			SimpleListModel lm = new SimpleListModel(datas);
			listbox.setModel(lm);
			Messagebox.show("The Listbox has been re-rendered: ");
		]]></attribute>
	</button>
</zk>

is it still cause this error?

or you can try to upgrade to latest ZK freshly and check whether the problem be solved

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2010-07-28 13:57:12 +0800

Seen: 423 times

Last updated: Aug 08 '10

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