java - WICKET - DataView refresh with ajaxButton -


i'm trying refresh dataview onsubmit function in ajaxbutton. create form 2 dropdownchoice , ajaxbutton.

when click on ajaxbutton in onsubmit function call dao function , replace listdataprovider, null before, new list dao.

final private webmarkupcontainer wmc = new webmarkupcontainer("wmc"); private listdataprovider<comparephoto> datap = new listdataprovider<comparephoto>();  dataview = (dataview<comparephoto>)new dataview<comparephoto>("vcomponents", datap){          private static final long serialversionuid = 1l;          @override         protected void populateitem(final item<comparephoto> item) {                  comparephoto c = item.getmodelobject();                  system.out.println("idcarto : "+c.getidcarto());                  repeatingview repeatingview = new repeatingview("datarow");                 repeatingview.add(new label(repeatingview.newchildid(), c.getidcarto()));                 [...]                  item.add(repeatingview);         }     };      dataview.setoutputmarkupid(true);     wmc.setoutputmarkupid(true);     wmc.add(dataview);     add(wmc);              ajaxbutton b = new ajaxbutton("btnsubmit") {                 protected void onsubmit(ajaxrequesttarget target, form<?> form)                {                    datap = new listdataprovider<comparephoto>(lstcomparephoto);                  target.add(wmc);                }             }  form.add(b); add(form); 

my html code :

<form wicket:id="formcomparepicture">                 <div align="center"><label for="datechoiceone"><select wicket:id="dateone"></select></label></div><br/>                 <div align="center"><label for="datechoicetwo"><select wicket:id="datetwo"></select></label></div><br/>                  <button wicket:id="btnsubmit">compare</button>                 <br/><br/><br/>             </form>              <div wicket:id="wmc">                 <div wicket:id="feedback"></div>                 <table id="componenttable">                     <thead>                         <tr>                             <th>id</th>                          </tr>                     </thead>                     <tfoot>                         <tr>                             <th>id</th>                         </tr>                     </tfoot>                      <tbody>                          <tr wicket:id="vcomponents">                             <td wicket:id="datarow"></td>                         </tr>                      </tbody>                 </table>             </div> 

absolutely nothing happen...

thanks help

you have override listdataprovider#getdata() provide up-to-date list:

private list<comparephoto> photos = new list<comparephoto>();  ...  listdataprovider<comparephoto> datap = new listdataprovider<comparephoto>() {     protected list<t> getdata() {         return photos;     } };  dataview = new dataview<comparephoto>("vcomponents", datap) {     ... };  ajaxbutton b = new ajaxbutton("btnsubmit") {     protected void onsubmit(ajaxrequesttarget target, form<?> form)     {         photos = ...;          target.add(wmc);     } }; 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -