我正在使用Prime Ui为我的应用程序使用RestFul Web服务。 我有一个数据表,当我点击一行时,会出现一个对话框,其中包含表格行的绑定和我编辑时提交的按钮。 现在提交后,我只需要刷新表,我会发疯,但它仍然无效。
这是我的html表
<div id="tblremote" style="width:70%; margin-left:auto; margin-right:auto; padding-top:15px">
</div>
这是我的javascript
$('#tblremote').puidatatable({
caption: 'Employees',
paginator: {
rows: 15
},
columns: [
{field:'name', headerText: 'name', sortable:true},
{field:'surname', headerText: 'surname', sortable:true},
{field:'address', headerText: 'address', sortable:true},
{field:'email', headerText: 'email', sortable:true}
],
datasource: function load(callback) {
$.ajax({
type: "GET",
url: '...',
dataType: "json",
context: this,
success: function(response) {
callback.call(this, response);
}
});
},
selectionMode: 'multiple',
rowSelect: function(event, data) {
$('#dlg').puidialog('show');
document.getElementById("name").innerHTML = data.name;
document.getElementById("surname").innerHTML = data.surname;
document.getElementById("address").innerHTML = data.address;
},
rowUnselect: function(event, data) {
$('#messages').puigrowl('show', [{severity:'info', summary: 'Row Unselected', detail: (data.name + ' ' + data.surname)}]);
}
});
$('#dlg').puidialog({
showEffect : 'fade',
hideEffect : 'fade',
width : 300,
modal : true,
location : 'center',
buttons : [ {
text : 'Submit',
icon : 'ui-icon-check',
click : function()
{
$('#dlg').puidialog('hide');
$.ajax({
type: "POST",
url: url,
context: this,
success: function() {
=(((((((((((((
}
});
}
}, {
text : 'Cancel',
icon : 'ui-icon-close',
click : function()
{
$('#dlg').puidialog('hide');
}
} ]
});
更新有效,但我无法刷新表格,对话框成功方法的功能是空的,因为我不知道我要写什么! 有人可以帮助我吗?
答案 0 :(得分:0)
Primeui有你可以通过JQuery访问的方法,但是没有刷新按钮。但是我可以链接到一个示例(primeui - php),它在paginator和数据表上定义了这样的方法。
//paginator, removes the class and creates again.
this.element.removeClass('pui-paginator ui-widget-header');
this._create();
//datatable also defines a refresh method that later can use like this:
success: function() {
$('#datatable').puidatatable('refresh',-1);
}
以下是所有来源的链接:
http://www.pm-consultant.fr/primeui/js/pmc/override/primeui-1.0/paginator.js
http://www.pm-consultant.fr/primeui/js/pmc/override/primeui-1.0/datatable.js