Prime ui Datatable Refresh after Ajax Post

jQuery UI Widgets
cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

30 Aug 2013, 11:22

Stay tuned for a little for 1.0.RC, this one and new features for datatable are in progress.

Mocho
Posts: 6
Joined: 10 Jun 2013, 17:10

01 Oct 2013, 14:24

ruorm ruorm tu

pmc34
Posts: 22
Joined: 16 Nov 2013, 16:00
Location: France
Contact:

23 Nov 2013, 15:06

Hi,

To reload the content of the datatable, I call the function sort like this :

Code: Select all

// Datatable content update
$('#tb_items').puidatatable('sort',[{field:'item_name', order: 1}]);
Where item_name is the column that I want to be sorted, order : 1 means the sort is to be done in ascending order.

waiting for a better solution, I hope it will be helpful ;)

Pascal,

psybases
Posts: 10
Joined: 29 May 2013, 12:21
Location: Greece

20 Feb 2014, 15:08

Is there any update for this issue?
Thanks.
optimus.prime wrote:Stay tuned for a little for 1.0.RC, this one and new features for datatable are in progress.
F. Papadopoulos
---
PrimeFaces 4.0 on WAS 8 using MyFaces

rubus
Posts: 517
Joined: 01 Oct 2010, 09:41
Location: Belgium

20 Feb 2014, 15:22

Hi,
Is there any update for this issue?
Not yet.

PrimeFaces 5.0 takes all the available time of Optimus Prime.

In the mean time, you can also have a look at http://forum.primefaces.org/viewtopic.p ... 29#p115829 for the refresh of the datatable.

regards
Rudy
PrimeFaces version 3.5, Tomcat 7, Mojarra 2.1.13
PrimeFaces version 4.0, Glassfish 4.0
PrimeFaces version 5.0, WLS 12.1.2
If you haven't read the forum rules read them now : viewtopic.php?f=3&t=1194

psybases
Posts: 10
Joined: 29 May 2013, 12:21
Location: Greece

20 Feb 2014, 15:46

Thanks, i have already seen this post but i am not sure where i should insert this code.
I have tried to insert it in the declaration of my datatable but this doesnt work.
Could you enlight on this?

rubus wrote:Hi,
Is there any update for this issue?
Not yet.

PrimeFaces 5.0 takes all the available time of Optimus Prime.

In the mean time, you can also have a look at http://forum.primefaces.org/viewtopic.p ... 29#p115829 for the refresh of the datatable.

regards
Rudy
F. Papadopoulos
---
PrimeFaces 4.0 on WAS 8 using MyFaces

rubus
Posts: 517
Joined: 01 Oct 2010, 09:41
Location: Belgium

21 Feb 2014, 10:07

Hi,

You have to insert it into the widget code (datatable.js)

Code: Select all

 $.widget("primeui.puidatatable", {

  // rest of PrimeUI code 
  // Insert code near the end.
}
So you have then a customized version of PrimeUI and every time you update with a new release, you have to insert it again (until it is available within PrimeUI itself).

Regards
Rudy
PrimeFaces version 3.5, Tomcat 7, Mojarra 2.1.13
PrimeFaces version 4.0, Glassfish 4.0
PrimeFaces version 5.0, WLS 12.1.2
If you haven't read the forum rules read them now : viewtopic.php?f=3&t=1194

psybases
Posts: 10
Joined: 29 May 2013, 12:21
Location: Greece

22 Feb 2014, 17:07

rubus wrote:Hi,

You have to insert it into the widget code (datatable.js)

Code: Select all

 $.widget("primeui.puidatatable", {

  // rest of PrimeUI code 
  // Insert code near the end.
}
So you have then a customized version of PrimeUI and every time you update with a new release, you have to insert it again (until it is available within PrimeUI itself).

Regards
Rudy

Thanks!
It seems to work.
F. Papadopoulos
---
PrimeFaces 4.0 on WAS 8 using MyFaces

mtbadi39
Posts: 2
Joined: 22 Oct 2014, 11:12

22 Oct 2014, 11:16


ensemblebd
Posts: 2
Joined: 30 Sep 2016, 16:37

08 Aug 2019, 20:34

Here's what I do to inject into the target :

Code: Select all

var inject_entry = function (container, name, sz_id) {
		var pl = $container.find('div.ui-picklist');
		var pldata = pl.data('primeuiPuipicklist');

		var old_data = [];
		pldata.targetList.find('li').each(function() {
			old_data.push({
				label: $(this).data('item-label'),
				value: $(this).data('item-value')
			});
		});
		var new_data=old_data;
		new_data.push({label:name,value:sz_id});
		pldata._populateInputFromData.call(pldata, pldata.targetList, pldata.options.targetData = new_data);
		pldata.targetList.find('li').remove();
		pldata.targetInput.empty();
		for (var i = 0; i < new_data.length; i++) {
			pldata.targetInput.append('<option value="'+new_data[i].value+'">'+new_data[i].label+'</option>');
		}
		pldata._populateContainerFromOptions.call(pldata, pldata.targetInput, pldata.targetList);
	};
	
	var $container = $('#mydivsomewhere');
	inject_entry($container, 'new option', 123);

Post Reply

Return to “PrimeUI”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest