views:

46

answers:

1

The scenario is like this ...say i have a grid and on clicking that button it will send that data to the grid and it will refresh automatically with new data display in the data...

$("#wics").click( function(){
    var grid = jQuery("#list10");
    var ids = grid.jqGrid('getGridParam','selarrrow');
    if (ids.length>0) {
        var names = [];
        for (var i=0, il=ids.length; i < il; i++) {
            var name = grid.jqGrid('getCell', ids[i], 'Name');
            names.push(name);
        }
        //alert ("Names: " + names.join(", ") + "; ids: " + ids.join(", "));
        $("#names").html(names.join(", "));
        $("#dialog-confirm").dialog({
            height:280,
            modal:true,
            buttons:{
                'Cancel': function(){
                    $(this).dialog('close');
                },
                'Confirm': function(){
                    //alert("Confirm");
                    $.ajax({
                        type: "POST",
                        url:  "/cpsb/unprocessedOrders.do",
                        data: { method: "releaseTowics",
                            orderNum: JSON.stringify(ids),
                            names: JSON.stringify(names)
                        },
                        dataType: "json"
                        success: function(msg){
                            alert(msg);
                        },
                        error: function(res, status, exeption) {
                            alert(res);
                        }
                    });
                }
            }
        });
    }
});

Now may be i will have to pull the new data with the success message in the grid ..basically just need to reload the grid automatically on clicking wics button

A: 

Probably you will find the answer to you question here: http://stackoverflow.com/questions/2928371/how-to-filter-the-jqgrid-data-not-using-the-built-in-search-filter-box/2928819#2928819?

If I correct understand your question you should replace $.ajax request to setting of url and postData parameters (correspond to data parameter of $.ajax) and page:1 on the second grid with respect of setGridParam method and call trigger('reloadGrid').

Oleg
thanks! can i do something like after finishing that ajax call $("#list10").jqGrid("reloadGrid") in confirm message?
paul
moreover i need to do a success message with the data I just push to server...what is the best way to do that? should write a function inside the success method?
paul