Need to Export to CSV all of the data that is in J

2019-04-12 08:44发布

问题:

I have created a custom button to Export to CSV inside of JQGrid, here is a bit of the code

content.AppendFormat(@"pager: $(""#{2}"") {1}).navGrid(""#{2}"", {0} edit: false, add: false, del: false {1})
            .navButtonAdd(""#{2}"", 
             {0} caption:""Export to CSV file "", 
             position:""first"",
             buttonicon:""none"",
             onClickButton: function () {0}
                 alert('Made it to Export to CSV ...');
             {1}
             {1});
            {3}.filterToolbar();
            {1});
        </script>", "{", "}", pagerID, tableID);
        return content.ToString().ToControl("div");

Problem is, I need all the data, not just the page that is render in the ui, so I want to use the built in funcationally of the search with all the parameters associated with it, but I also want to append '&oper=csv', I just don't know how to go about it. Should I do it using a custom button, or something else.

回答1:

You can try to use excelExport method of jqGrid from grid.import.js. Loot at http://www.trirand.net/documentation/php/_2v212tis2.htm and http://www.trirand.net/forum/default.aspx?g=posts&t=183. Probably it is whhat you are looking for.