Page 1 of 2

Prime ui Datatable Refresh after Ajax Post

Posted: 08 Aug 2013, 09:22
by Mocho
Hi i'm using Prime Ui for my Application with A RestFul Web Service. i have a datatable and when i click on a row, appears a dialog with a form that contains the bind of the row of the table and a button for submit when i edit it. Now after submit i need to refresh only the table, i'm going crazy but it still not working.

This is my html table

Code: Select all

<div id="tblremote" style="width:70%; margin-left:auto; margin-right:auto; padding-top:15px">

</div>
and this is my javascript

Code: Select all

$('#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');
        }
    } ]
});
The update works, but i can't refresh the table, the function of success method of dialog is empty because i don't know what i have to write! There is anyone that can help me?

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 08 Aug 2013, 11:28
by cagatay.civici
Do you mean how to reload datatable data on success callback of dialog button click? You want to reload remote data right?

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 08 Aug 2013, 13:51
by Mocho
Yes, after post, i want refresh datatable with new data.

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 08 Aug 2013, 14:53
by cagatay.civici
I see, let me do a local test and get back to you.

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 08 Aug 2013, 14:57
by Mocho
ok thank's

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 16 Aug 2013, 12:26
by chrisihoby
Hi every one,

I also have this problem, the datatable can't refresh data after ajax loading. Is there an issue for that?


Thanks

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 16 Aug 2013, 12:29
by cagatay.civici
I've seen the issue, will add a reload method soon along with other new features. PrimeUI 1.0 is due 2 weeks time.

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 16 Aug 2013, 12:37
by chrisihoby
Okay, thanks a lot optimus ;)

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 26 Aug 2013, 09:26
by Mocho
Thank's a lot!

Re: Prime ui Datatable Refresh after Ajax Post

Posted: 27 Aug 2013, 15:37
by ivisa
How fix until you get the update? :(