Prime ui Datatable Refresh after Ajax Post

jQuery UI Widgets
Mocho
Posts: 6
Joined: 10 Jun 2013, 17:10

08 Aug 2013, 09:22

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?

cagatay.civici
Prime
Posts: 18113
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Aug 2013, 11:28

Do you mean how to reload datatable data on success callback of dialog button click? You want to reload remote data right?

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

08 Aug 2013, 13:51

Yes, after post, i want refresh datatable with new data.

cagatay.civici
Prime
Posts: 18113
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Aug 2013, 14:53

I see, let me do a local test and get back to you.

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

08 Aug 2013, 14:57

ok thank's

chrisihoby
Posts: 10
Joined: 26 Nov 2010, 11:28
Contact:

16 Aug 2013, 12:26

Hi every one,

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


Thanks

cagatay.civici
Prime
Posts: 18113
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Aug 2013, 12:29

I've seen the issue, will add a reload method soon along with other new features. PrimeUI 1.0 is due 2 weeks time.

chrisihoby
Posts: 10
Joined: 26 Nov 2010, 11:28
Contact:

16 Aug 2013, 12:37

Okay, thanks a lot optimus ;)

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

26 Aug 2013, 09:26

Thank's a lot!

ivisa
Posts: 1
Joined: 27 Aug 2013, 15:23

27 Aug 2013, 15:37

How fix until you get the update? :(

Post Reply

Return to “PrimeUI”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest