-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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..
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?
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());
private void renderListBox(List theDataList, Listbox theListBox, ListitemRenderer theRenderer) { ListModel listModel = new SimpleListModel(theDataList); theListBox.setModel(listModel); theListBox.setItemRenderer(theRenderer); }//end method
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
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.
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
Asked: 2010-07-28 13:57:12 +0800
Seen: 423 times
Last updated: Aug 08 '10