andycrespo27 / flexigrid

Automatically exported from code.google.com/p/flexigrid
0 stars 0 forks source link

Refresh only the flexigrid when popup close #67

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have a button "add" in flexigrig, when I click this button opens a pop-up to 
record data, and ends when the popup is closed by javascript (window.close), 
but I would like to refresh data in flexigrid original window before closing 
the popup. is it possible? whose syntax

Original issue reported on code.google.com by barbaro...@gmail.com on 16 Aug 2011 at 12:43

GoogleCodeExporter commented 8 years ago
What you want is $(".tablestuff").flexReload('list_stuff_json.php'), inside the 
click function of dialog

function addStuff(com, grid) {
    if (com == 'Add Stuff') {

        $("#dialog").dialog({ buttons: [{
                text: "Add Stuff",              
                click: function() {                 
                    $.ajax({
                      url: 'stuff.php',
                      success: function( data ) {                     
                            if (data.length > 1) {                                                              
                                $('#error').html(data);                             
                            } else {
                                $('#dialog').dialog('close');
                                $(".tablestuff").flexReload('list_stuff_json.php'); 
                            }
                      },
                      error: function(msg) { alert(msg); }
                    });                         
                }
            }],
            height: 150
        }); 

        $('#dialog').html("<div class='dataform'><label>Stuff Description:</label><input type='text' id='textStuff' size='40' maxlength='40'></h2><div id='error'></div></div>");       
        $('#dialog').dialog('open');                
        $("#dialog").dialog({ title: 'Add Stuff'});             

    } 
}

Original comment by Vormav...@gmail.com on 19 Aug 2011 at 11:17

GoogleCodeExporter commented 8 years ago
firebug error

$("#dialog").dialog is not a function
 height: 150 

Original comment by barbaro...@gmail.com on 22 Aug 2011 at 2:41

GoogleCodeExporter commented 8 years ago
dialog is a "widget" from jQuery UI (http://jqueryui.com/)
Its just a sample. in your case, just replace it by your div management routine.

Original comment by Vormav...@gmail.com on 27 Aug 2011 at 7:10