Re: Prime ui Datatable Refresh after Ajax Post
Posted: 30 Aug 2013, 11:22
Stay tuned for a little for 1.0.RC, this one and new features for datatable are in progress.
Code: Select all
// Datatable content update
$('#tb_items').puidatatable('sort',[{field:'item_name', order: 1}]);
optimus.prime wrote:Stay tuned for a little for 1.0.RC, this one and new features for datatable are in progress.
Not yet.Is there any update for this issue?
rubus wrote:Hi,
Not yet.Is there any update for this issue?
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
Code: Select all
$.widget("primeui.puidatatable", {
// rest of PrimeUI code
// Insert code near the end.
}
rubus wrote:Hi,
You have to insert it into the widget code (datatable.js)
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).Code: Select all
$.widget("primeui.puidatatable", { // rest of PrimeUI code // Insert code near the end. }
Regards
Rudy
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);