Page 2 of 2

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 30 Aug 2013, 11:22
by cagatay.civici
Stay tuned for a little for 1.0.RC, this one and new features for datatable are in progress.

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 01 Oct 2013, 14:24
by Mocho
ruorm ruorm tu

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 23 Nov 2013, 15:06
by pmc34
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,

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 20 Feb 2014, 15:08
by psybases
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.

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 20 Feb 2014, 15:22
by rubus
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

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 20 Feb 2014, 15:46
by psybases
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

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 21 Feb 2014, 10:07
by rubus
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

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 22 Feb 2014, 17:07
by psybases
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.

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 22 Oct 2014, 11:16
by mtbadi39

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 08 Aug 2019, 20:34
by ensemblebd
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);