datagrid 动态列
var options={};
$(function(){
var myNj = 9;
//初始化
$("#disgrid").datagrid({
type: 'POST',
nowrap: false,
striped: true,
fit:true,
width:1024,
height:500,
url:'',
pageSize:30,
remoteSort: false,
pagination:true,
rownumbers:true,
singleSelect:true,
queryParams:{
nj:myNj,
unitType:1
}
});
fetchData(myNj);
});
function fetchData(nj) {
var s = "";
s = "[[";
s = s + "{field:'unitname',title:'单元',width:160},{field:'practicetime',title:'测试 时间',width:160},{field:'userid',title:'userid',width:120,hidden:'true'}, {field:'serial',title:'serial',width:120,hidden:'true'},{field:'unitid',title:'unitid',width:100,hidden:'true'},";
//lu todo 列的定义可从服务器获得
if (nj==9) {
s = s + "{field:'aipanel_text_exam',title:'短文朗读',width:80}, {field:'aipanel_scene_exam',title:'情景对话',width:80}, {field:'aipanel_oral_exam',title:'简短说话',width:80}";
s = s + ",{field:'tatal_score',title:'总分',width:60,formatter:function(value,rec) {return paraseIntValue(rec.aipanel_text_exam)+paraseIntValue(rec.aipanel_scene_exam)+paraseIntValue(rec.aipanel_oral_exam);}}";
}else if (nj==7||nj==8){
//....
}
s = s + "]]";
options={};
options.url = '/app/search.do';
options.queryParams = {
nj:nj,
unitType:1
};
options.columns = eval(s);
//lu 增加一列
options.columns[0].push(
{
field:'desc',title:'查看详情',width:60,
formatter:function(value,rec){
return "<a href=\"javascript:showDescInfo(\'"+rec.serial+"\',\'"+rec.scene_score+" \',\'"+rec.total_score+"\');\">详情</a>";
}
}
);
$('#disgrid').datagrid(options);
$('#disgrid').datagrid('reload');
}
转自:http://yuncode.net/code/c_5417f4ed435cc82
datagrid 动态列的更多相关文章
- WPF datagrid 动态增加列
DataGrid动态增加列 <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.m ...
- Easy DataGrid 实现动态列、行
Easy DataGrid 实现动态列.行 前端代码: <title>展示销售的实时数据</title> <script type="text/javascri ...
- WPF Datagrid 动态生成列 并绑定数据
原文:WPF Datagrid 动态生成列 并绑定数据 说的是这里 因为列头是动态加载的 (后台for循环 一会能看到代码) 数据来源于左侧列 左侧列数据源 当然num1 属于临时的dome使用 可 ...
- Wpf DataGrid动态添加列,行数据(一)
由于最近有这方面的需求,而且刚接触wpf不久,在网上找了很多方法,都不是使用MVVM模式的,因为DataGrid的列不能绑定 这就难受了,我想了个折中的方法,这个是使用了MVVMLight的消息机制, ...
- WPF DataGrid动态生成列的单元格背景色绑定
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Column.DisplayInde ...
- 转载 -- jquery easyui datagrid 动态表头 + 嵌套对象属性展示
代码功能: 1.datagrid 的表头由后台生成,可以配置在数据库 2.datagrid 的列绑定数据 支撑嵌套对象 $(function() { var columns = new Array() ...
- easyui datagrid 动态加入、移除editor
使用easyui 行编辑的时候完毕编辑的功能比較简单,可是假设要依据一个框的值动态改变别的值或者编辑的时候禁用某个框的时候就比較麻烦了. 比方像以下这样:加入行的时候每一个值都是手动输入,改动的时候第 ...
- WPF 动态列(DataGridTemplateColumn) 绑定数据 (自定义控件)对象绑定
原文:WPF 动态列(DataGridTemplateColumn) 绑定数据 (自定义控件)对象绑定 WPF 动态列(DataGridTemplateColumn) 绑定数据 (自定义控件) 上面的 ...
- WPF 动态列(DataGridTemplateColumn) 绑定数据 (自定义控件)
原文:WPF 动态列(DataGridTemplateColumn) 绑定数据 (自定义控件) 因为项目需要 要实现这个~ 怎么实现画红框内容部分 田字格和上面Textbox 属于一个自定义控件 大 ...
随机推荐
- 关于SQL SERVER的N前缀的理解
加N前缀指定后面的字符串为UNICODE常量, SQL Server 的 标准中的国家字符数据类型.SQL 使用前缀字符 N 标识这些数据类型及其值. , ),使用 个 个 Unicode字符时,使用 ...
- elclipse/myeclipse web.xml自动提示补全问题
默认情况下,在编辑web.xml时是没有自动提示功能的,只能在编辑完成保存时验证语法是否正确. 解决方法: 1.下载(保存)http://java.sun.com/xml/ns/j2ee/web-ap ...
- spring源码 — 一、IoC容器初始化
IoC容器初始化 注意:本次的spring源码是基于3.1.1.release版本 容器:具有获取Bean功能--这是最基本功能,也是BeanFactory接口定义的主要行为,在添加了对于资源的支持之 ...
- Android Studio no debuggable applications解决方案2
android studio 默认是没有开启debuggable 功能的,在tools里打开该功能即可,Tools->Android->Enable ADB Integration. 刚设 ...
- ArrayList/Vector的原理、线程安全和迭代Fail-Fast
疑问 * ArrayList是非线程非安全的,具体是指什么?具体会产生什么问题?* ArrayList的内部原理是什么?为什么可以动态扩容?* Vector是线程安全的,具体是如何实现的?为什么不再推 ...
- nodejs学习之表单提交(1)
nodejs作为一门后端语言,接触的最多的是它的框架,但是它本身的api我觉得更是非学不可,所有才有了这篇文章 表单提交是最基本的也是最实用的入门实例 HTML: <!DOCTYPE html& ...
- EWM 强大的数据修复功能
在上了EWM系统后,运行一段时间可能因为不正确的操作,系统意外情况数据不一致的问题,交货单行项目状态不致,等等报不一致的情况,EWM的自检功能比较强. 下面介绍一种数据不致的修复工具之一,tx: /S ...
- Passwordless SSH Login
原文地址:http://manjeetdahiya.com/2011/03/03/passwordless-ssh-login/ Consider two machines A and B. We w ...
- IOS开发之不同版本适配问题2(#ifdef __IPHONE_7_0)
继续说说ios不同版本之间的适配 先说一个东西:在xcode当中有一个东西叫targets,苹果的官方文档是这样说的: A target specifies a product to build an ...
- clearfix清除浮动进化史
我想大家在写CSS的时候应该都对清除浮动的用法深有体会,今天我们就还讨论下clearfix的进化史吧. clearfix清除浮动 首先在很多很多年以前我们常用的清除浮动是这样的. .clear{cle ...