Updating datatable ajax

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Updating datatable ajax

anton
How could update a datatable?


DefaultDataTable datatable = createDataTable();

text.add(new AjaxFormComponentUpdatingBehavior("onchange")        {
@Override            protected void onUpdate(AjaxRequestTarget target)            {
                              datatable.setOutputMarkupId(true);              target.addComponent(datatable);                                              }}I can not update datatable.

     
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

Sven Meier
The markupId has to be rendered before the actual Ajax request:

DefaultDataTable datatable = createDataTable();
datatable.setOutputMarkupId(true);

text.add(new AjaxFormComponentUpdatingBehavior("onchange") {
   @Override
   protected void onUpdate(AjaxRequestTarget target) {
     target.addComponent(datatable);
}}

Sven


On 11/08/2012 10:46 PM, Antonio muñoz alonso wrote:

> How could update a datatable?
>
>
> DefaultDataTable datatable = createDataTable();
>
> text.add(new AjaxFormComponentUpdatingBehavior("onchange")        {
> @Override            protected void onUpdate(AjaxRequestTarget target)            {
>              datatable.setOutputMarkupId(true);              target.addComponent(datatable);                                              }}I can not update datatable.
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

anton
modified but not update the datatable.
after selecting the text does not call the function createDataTable();

¿?
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

Sven Meier
Why do you want to recreated the dataTable?

Sven
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

anton
depending on what you specify in the text appear one row or other.

replaceWith,does not work
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

anton
In reply to this post by Sven Meier
depending on what you specify in the text appear one row or other.

replaceWith,does not work



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-datatable-ajax-tp4653734p4653743.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

Sven Meier
In reply to this post by anton
Normally you just add the table to the ART an when it regenerates its HTML it will use new data from your data provider.

Sven

anton <[hidden email]> schrieb:

>depending on what you specify in the text appear one row or other.
>
>replaceWith,does not work
>
>
>
>--
>View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-datatable-ajax-tp4653734p4653743.html
>Sent from the Users forum mailing list archive at Nabble.com.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

anton
I use a class extends of DataProvider.
The problem is that not change the values ​​in the table, no updating. ¿?
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

Sven Meier
Show us the relevant code from your DataProvider.

Sven

anton wrote
I use a class extends of DataProvider.
The problem is that not change the values ​​in the table, no updating. ¿?
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

anton
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

Sven Meier
The interesting stuff is missing:
How do you pass the input of your textField into your provider to
limit/filter the values?

Sven

On 11/20/2012 04:13 PM, anton wrote:

> UserProvider.java
>
> https://cwiki.apache.org/WICKET/simple-sortable-datatable-example.html
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-datatable-ajax-tp4653734p4654028.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

anton
This post was updated on .
There is a DropChoice.
Depending on the selected item should appear the list of users.

Automatic table should be generated with users,after this line target.addComponent(table); ¿?

ContactProvider contactProvider = new ContactProvider(ListUser());
  final AjaxFallbackDefaultDataTable<User> table =new AjaxFallbackDefaultDataTable<User>("table", columns, UserProvider, 10);
       
It does this either  --> table.setDefaultModelObject(new UsertProvider(ListUser()); or replaceWith.

Any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

Sven Meier
> table.setDefaultModelObject(new UsertProvider(ListUser())

The dataTable doesn't use its model object and you cannot change the dataProvider either.

You have to make your UserProvider dynamic:

   table = new DataTable(..., new IDataProvider<User>() {
     @Override
     protected List<User> getList() {
       // get users *matching the current filter input*
       // .. and sort it
     }
     ...
   });

Sven


On 11/20/2012 05:40 PM, anton wrote:

> There is a DropChoice.
> Depending on the selected item should appear the list of users.
>
> Automatic table should be generated with users,after this line
> target.addComponent(table); ¿?
>
> ContactProvider contactProvider = new ContactProvider(ListUser());
>    final AjaxFallbackDefaultDataTable<User> table =new
> AjaxFallbackDefaultDataTable<Usert>("table", columns, contactProvider, 10);
>          
> It does this either  --> table.setDefaultModelObject(new
> UsertProvider(ListUser()); or replaceWith.
>
> Any ideas?
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-datatable-ajax-tp4653734p4654041.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

anton
     //UserProvider extends SortableDataProvider

final ISortableDataProvider<User> datatable = new UserProvider(tableValue()){

                        private static final long serialVersionUID = 1L;

                        @Override
            public List<Contact> getList()
            {          
              return tableValue(); //returns the values ​​for the selected options
            }

        };
still does not update the table ¿?
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

Sven Meier
Please read here:

http://stackoverflow.com/questions/7935227/apache-wicket-datatable-filtering-with-filtertoolbar-vs-manual-filtering

Sven

On 11/20/2012 08:48 PM, anton wrote:

>       //UserProvider extends SortableDataProvider
>
> final ISortableDataProvider<User> datatable = new
> UserProvider(tableValue()){
>
> private static final long serialVersionUID = 1L;
>
> @Override
>              public List<Contact> getList()
>              {
>                return tableValue(); //returns the values ​​for the selected
> options
>              }
>
>          };
> still does not update the table ¿?
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-datatable-ajax-tp4653734p4654046.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

anton
I do not understand how you can be so hard to update a table
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

anton
help please !!!!
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

Paul Bors
Silly question, but do you refresh the table either via Ajax or a page refresh by sending a parameter of your data provider through a constructor or something?

Because simply manipulating the data provider will no magically redraw things on the screen :)

Put a log or break in your data provider and see it for your self.

Have a great day,
Paul Bors

On Nov 20, 2012, at 6:21 PM, anton <[hidden email]> wrote:

> help please !!!!
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-datatable-ajax-tp4653734p4654051.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

~ Thank you,
    Paul@Bors.ws
Reply | Threaded
Open this post in threaded view
|

Re: Updating datatable ajax

Paul Bors
I stand corrected as I missed one of your replies. I see now that you're using Ajax and you have a drop down of which value you would like to append an extra row to your table.

Yes, keep the list in memory if its small enough and add the enter in the correct place and the refresh the table via Ajax. As long as your data provider manipulates the same list it should work just fine.

If you want code examples let me know, I have plenty of those add new editable rows.

Have a great day,
Paul Bors

On Nov 24, 2012, at 1:03 AM, "Paul Borș" <[hidden email]> wrote:

> Silly question, but do you refresh the table either via Ajax or a page refresh by sending a parameter of your data provider through a constructor or something?
>
> Because simply manipulating the data provider will no magically redraw things on the screen :)
>
> Put a log or break in your data provider and see it for your self.
>
> Have a great day,
> Paul Bors
>
> On Nov 20, 2012, at 6:21 PM, anton <[hidden email]> wrote:
>
>> help please !!!!
>>
>>
>>
>> --
>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Updating-datatable-ajax-tp4653734p4654051.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

~ Thank you,
    Paul@Bors.ws