首页 > 代码库 > pqgrid对json数据的绑定

pqgrid对json数据的绑定

$(function () {    var data = http://www.mamicode.com/[[1, ‘Exxon Mobil‘, ‘339,938.0‘, ‘36,130.0‘],"Grid From Array" };    obj.colModel = [{ title: "Rank", width: 100, dataType: "integer" },    { title: "Company", width: 200, dataType: "string" },    { title: "Revenues ($ millions)", width: 150, dataType: "float", align: "right" },    { title: "Profits ($ millions)", width: 150, dataType: "float", align: "right"}];    obj.dataModel = { data: data };    var $grid = $("#grid_parts").pqGrid(obj);    $("#grid_parts_topVisible").change(function (evt) {        //alert("");        $grid.pqGrid("option", "topVisible", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "topVisible"));    $("#grid_parts_bottomVisible").change(function (evt) {        //alert("");        $grid.pqGrid("option", "bottomVisible", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "bottomVisible"));    $("#grid_parts_columnBorders").change(function (evt) {        //alert("");        $grid.pqGrid("option", "columnBorders", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "columnBorders"));    $("#grid_parts_rowBorders").change(function (evt) {        //alert("");        $grid.pqGrid("option", "rowBorders", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "rowBorders"));    $("#grid_parts_oddRowsHighlight").change(function (evt) {        //alert("");        $grid.pqGrid("option", "oddRowsHighlight", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "oddRowsHighlight"));    $("#grid_parts_numberCell").change(function (evt) {        //alert("");        $grid.pqGrid("option", "numberCell", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "numberCell"));     $("#grid_parts_autoHeight").change(function (evt) {        //alert("");        $grid.pqGrid("option", "flexHeight", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "flexHeight"));     $("#grid_parts_autoWidth").change(function (evt) {        //alert("");        $grid.pqGrid("option", "flexWidth", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "flexWidth"));     $("#grid_parts_horizontal").change(function (evt) {        //alert("");        $grid.pqGrid("option", "scrollModel", { horizontal: $(this).is(":checked") });    }).attr("checked", $grid.pqGrid("option", "scrollModel.horizontal"));     $("#grid_parts_resizable").change(function (evt) {        //alert("");        $grid.pqGrid("option", "resizable", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "resizable"));     $("#grid_parts_paging").change(function (evt) {        var paging="";        if ($(this).is(":checked")) {            paging = "local";        }        $grid.pqGrid("option", "dataModel.paging", paging);    }).attr("checked", ($grid.pqGrid("option", "dataModel.paging")=="local")?true:false);     $("#grid_parts_roundCorners").change(function (evt) {        $grid.pqGrid("option", "roundCorners", $(this).is(":checked"));    }).attr("checked", $grid.pqGrid("option", "roundCorners"));});

 因为它可以免费商用,也不需要你开源,而且完全支持jquery 很不错的一个前端表格控件。