wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: AjaxFallbackDefaultDataTable Refresh Data Provider
Date Sat, 03 Dec 2011 21:26:42 GMT
Hi,

Just make your data provider a bit smarter/dynamic.

Currently you pass the filter data statically: new
SortableIncidentDataProvider("INCIDENT_TS",myListParams).
Rework it to be dynamic:
new SortableIncidentDataProvider("INCIDENT_TS) {

  protected MyParams generateParameters() {
    return extractTheParametersFromTheRequestOrElsewhere();
  }
}

On Sat, Dec 3, 2011 at 10:19 PM, mashleyttu <mashley@gmail.com> wrote:
> Hi,
>
> I'm using an AjaxFallbackDefaultDataTable and I am trying to update the Data
> Provider during an Ajax call back. A little more details is I have a
> TextField with an AjaxFormComponentUpdatingBehavior("onkeyup") behavior
> attached for filtering results in my AjaxFallbackDefaultDataTable.
>
> Long story short, is I do not know how to update the Data Provider for the
> Table and have the filtered results displayed in the web browser. I've had
> to settle on creating a new AjaxFallbackDefaultDataTable and use the
> replaceWith function to display he results. Please see code below.
>
> TextField txtIncidentFilter = (TextField)
> IncidentListViewPanel.this.get("rowSearch:txtIncidentFilter");
>                                        String searchQuery = (String)
> txtIncidentFilter.getDefaultModelObject();
>                                        WebMarkupContainer cntIncidentList
= (WebMarkupContainer)
> IncidentListViewPanel.this.get("cntIncidentList");
>                                        AjaxFallbackDefaultDataTable
cmp = (AjaxFallbackDefaultDataTable)
> cntIncidentList.get("tblIncidents");
>
> myListParams.setQueryString("%"+Commons.nvl(searchQuery,"")+"%".toLowerCase());
>                                        AjaxFallbackDefaultDataTable
newIncidentFilterResults = new
> AjaxFallbackDefaultDataTable("tblIncidents",columns,new
> SortableIncidentDataProvider("INCIDENT_TS",myListParams),rowCount);
>                                        cmp.replaceWith(newIncidentFilterResults);
>                                        cmp = newIncidentFilterResults;
>                                        cmp.setOutputMarkupId(true);
>                                        target.addComponent(cmp);
>                                        target.addComponent(cntIncidentList);
>
> This works fine but I would think requires a lot of extra processing/memory
> etc, where you should simply be able to update the dataprovider for the
> component.
>
> Does anyone know how to provide a new data provider for a
> AjaxFallbackDefaultDataTable component?
>
> Using wicket 1.4.15 in PROD.
>
> Thanks,
> Matt
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-Refresh-Data-Provider-tp4154899p4154899.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Mime
View raw message