前端
function goqry() {
$("#form").form("submit", {
url: "CJCK_bjcjfx_yfsl.aspx?opt=qry",
onSubmit: function () {
if ($(this).form(‘validate‘)) {
$(‘#tt‘).datagrid("loading");
return true;
} else {
return false;
}
},
success: function (data) {
data = jQuery.parseJSON(data);
if (data.columns != undefined) {
if (data.columns.length == 4) {
if (data.total > 0) {
var frozenColumns = $(‘#tt‘).datagrid("options").frozenColumns;
for (var i = 0; i < frozenColumns[0].length; i++) {
frozenColumns[0][i].rowspan = 4;
}
}
} else if (data.columns.length == 3) {
if (data.total > 0) {
var frozenColumns = $(‘#tt‘).datagrid("options").frozenColumns;
for (var i = 0; i < frozenColumns[0].length; i++) {
frozenColumns[0][i].rowspan = 3;
}
}
}
if (data.columns != null) {
$(‘#tt‘).datagrid({
columns: data.columns,
data: data.rows
});
} else {
$(‘#tt‘).datagrid({
data: data.rows
});
}
} else {
$(‘#tt‘).datagrid({
data: data.rows,
columns:[[]]
});
}
$(‘#tt‘).datagrid("loaded");
}
});
}
后台代码
response.write(xx());
public string xx(){
EasyUIDatagrid data = new EasyUIDatagrid();
data.total = dt.Rows.Count;
data.rows = DataTableToobject(dt);
data.columns = head;
return ToJson(data);
}
public class EasyUIDatagrid
{
public int total;
public object[] rows;
public object[] footer;
public string topmsg;
public EasyUIDatagridHead[][] columns;
public EasyUIMergeCells[] mergeCells;
}