$(document).ready(function () { $.ajax({ url: "/gridtest/gettestdata", datatype: "json", type: "post", async: false, success: function (result) { $("#datagrid").jqgrid({ datatype: 'jsonstring', data: result, gridview: true, colmodel: result, height: "auto", loadcomplete: function (data) { alert('loaded'); }, loaderror: function (xhr, status, error) { alert('error'); } }); }, error: function (x, e) { alert(x.readystate + " " + x.status + " " + e.msg); } }); }); string result = "['id', 'first name', 'last name', 'last 4 ssn', 'department', 'age', 'salary', 'address', 'marital status']";
hello,
i have problem showing json data in dynamic jqgrid.i using json string @ serverside , set column names , data string @ ajax function.grid loading not show @ page. tried many alternatives not show json data in jqgrid. wrong way here? in advance
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/redmond/jquery-ui.css" /> <link rel="stylesheet" type="text/css" href="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/css/ui.jqgrid.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/i18n/grid.locale-en.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.base.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.common.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.formedit.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.inlinedit.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.celledit.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.subgrid.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.treegrid.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.grouping.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.custom.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/jquery.fmatter.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/jquery.searchfilter.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/grid.jqueryui.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/src/jqdnr.js"></script> <!--<script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/js/i18n/grid.locale-en.js"></script> <script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqgrid/jquery.jqgrid-3.8.2/js/jquery.jqgrid.min.js"></script>--> $.ajax({ type: "post", //url: "../dynamiccolumnbinding.txt", url: "/gridtest/gettestdata", datatype: "json", async: false, success: function (result) { var cold = result.couponstriplist, colm = result.colmodellist; alert(typeof(result)); $("#datagrid").jqgrid({ datatype: 'local', data: cold.rootvar, gridview: true, colmodel: colm, height: "auto", loadcomplete: function (data) { alert('loaded'); }, loaderror: function (xhr, status, error) { alert('error'); } }); }, error: function (x, e) { alert(x.readystate + " " + x.status + " " + e.msg); } }); }); string datafile = system.io.file.readalltext(server.mappath("~/dynamiccolumnbinding.txt")); jss.serialize(text); return json(datafile, jsonrequestbehavior.allowget);
Comments
Post a Comment