General Category > Help for ParamQuery Pro

load data on button click

(1/2) > >>

I want to load data in the grid on button click.
I am using MVC so on button click I get the data from the controller. I need to also refresh the grid so I can load the data. When I click the button which does a GET to the controller, it just sends the JSON to the browser and doesn't load in the grid.
I tried $("#jsongrid").pqGrid('refresh') but it didn't load the data. I also tried refreshDataAndView.

I can probably use jQuery's load method but I must be missing something simple.

[ Only Pro members may read this post. ]

[ Only Pro members may read this post. ]

This is the datamodel for the main grid and shows I am using remote location.

--- Code: ---  dataModel: {
                dataType: "JSON",
                location: "remote",
                recIndx: "ID",
                url: "/PCA/PCAData",
                getData: function (response) {
                    return { data: response };
--- End code ---

I want the grid to not load data when the page loads. After I enter a parameter in an input, I want to click a button and have the parameter sent to the server and get the JSON back and load the grid with data.

I assume I need to remove the data model from the grid declaration and call the data model in the button click like below.

--- Code: ---       
            $( "#jsongrid" ).pqGrid("option","dataModel.getData",function( response, textStatus, jqXHR ){});

--- End code ---

[ Only Pro members may read this post. ]


[0] Message Index

[#] Next page

Go to full version