MainViewController.js文件:
me.view.getDataGrid().load({"pageIndex":me.view.getDataGrid().pageIndex});//指定页号查询
me.view.getDataGrid() 是MainView.js文件中方法:
/**
* 获取DataGrid网格列表对象
*/
me.getDataGrid = function(){
return _dataGrid;
}
_dataGrid为 定义的 datagrid:
function _initDataGrid()
{
var restUrl = "~/rest/testControllerMapping/";
/* 初始化 EntityContainer */
var gridEntityContainer = new mx.datacontainers.GridEntityContainer({
baseUrl : basellerconsrelation.mappath(restUrl),
iscID : "-1", // iscID 是数据元素的统一权限功能编码。默认值为 "-1" ,表示不应用权限设置。
primaryKey: "relationId"
});
/* 初始化 DataGrid */
_dataGrid = new mx.datacontrols.ComplexGrid({
// 构造查询属性。
alias: "MainViewDataGrid",
columns:[
{ name: "id", caption: "公司ID" , editorType: "TextEditor",align : "center",width : "15%" },
{ name: "name", caption: "公司名称" ,editorType: "TextEditor",align : "center",width : "15%",
renderCell : function(p_item, $p_cell) {
var id = p_item.getValue("id");
$p_cell.css({
"color" : "blue",
"cursor" : "pointer"
});
$p_cell.text(p_item.getValue("name"));
$p_cell.click(function() {
me.controller.nameClick(id);
})
}
},
{ name: "consname", caption: "用户名称" , editorType: "TextEditor",align : "center",width : "15%",
renderCell : function(p_item, $p_cell) {
var id = p_item.getValue("id");//获取值
$p_cell.css({"color" : "blue",
"cursor" : "pointer"
});
//获取值 p_item.getValue("consname")
//重新赋值 $p_cell.text(p_item.getValue("consname"));
$p_cell.click(function() {
me.controller.consnameClick(id);
})
}
},
{ name: "affixInfo", caption: "附件" , editorType: "TextEditor",align : "center",dataAlign : "right",width : "5%",
renderCell : function(p_item, $p_cell) {
var participantid = p_item.getValue("relationId");
$p_cell.css({
"color" : "blue",
"cursor" : "pointer"
});
$p_cell.text(p_item.getValue("affixInfo")==null?0:p_item.getValue("affixInfo"));
$p_cell.click(function() {
var fjMvc = new basellerconsrelation.views.regPartaffixinfoMainViewController(
{
"participantid":participantid
});
fjView = new fjMvc.getView();
fjView._initDataGrid(participantid);
// 显示详细信息页面
_showDetailFormView(fjView, "附件信息");
})
}},
{ name: "state", caption: "数据状态" , editorType: "TextEditor",align:"center",width : "10%",
renderCell: function(p_item, $p_cell){
var status = p_item.getValue('state');
//将数字显示为对应汉字
if(status == "1"){
$p_cell.text("待受理");
}else if(status == "2"){
$p_cell.text("驳回");
}else if(status == "3"){
$p_cell.text("通过");
}else if(status=="0"){
$p_cell.text("待提交");
}else{
$p_cell.text("");
}
}},
{ name: "preType", caption: "预处理状态" , editorType: "TextEditor",align:"center",width : "8%",
renderCell: function(p_item, $p_cell){
var preType = p_item.getValue('preType');
if(preType == "0"){
$p_cell.text("预通过");
}else if(preType == "1"){
$p_cell.text("预驳回");
}else{
$p_cell.text("");
}
}},
{ name: "effectiveData", caption: "生效日期" , editorType: "DateTimeEditor",width : "8%", formatString: "yyyy-MM-dd",align : "center",dataAlign : "center"},
{ name: "expiryDate", caption: "失效日期" , editorType: "DateTimeEditor" ,width : "8%", formatString: "yyyy-MM-dd",align : "center",dataAlign : "center"},
{ name: "busCount", caption: "单元" , width : "6%", align : "center", dataAlign : "right",
renderCell : function(p_item, $p_cell) {
var consid = p_item.getValue("id");
$p_cell.css({
"color" : "blue",
"cursor" : "pointer"
});
$p_cell.text(p_item.getValue("busCount")==null?0:p_item.getValue("busCount"));
$p_cell.click(function() {
var unitMvc = new baSellerConsRelationChangeApprove.views.unitMainViewController(
{
"id": id,
"applyType": applyType
});
unitView = new unitMvc.getView();
// 显示详细信息页面
_showDetailFormView(unitView, "单元信息");
})
}
},
{ name: "yj", caption: "意见" , editorType: "TextEditor",align : "center",dataAlign : "center",width : "7%",
renderCell : function(p_item, p_cell) {
p_cell.css({
cursor : "pointer",
color : "blue"
});
p_cell.text(p_item.getValue("yj"));
p_cell.click(function(){
var view = new basellerconsrelation.views.jyzxyjView({id : p_item.getValue("relationId")});
var win = me.createWin(1000, 500, "审批意见");
win.setView(view);
win.showDialog();
});
}}
],
// 构造列排序条件,如果有多列,则以逗号分隔。例sorter: "school ASC, class DESC"
displayCheckBox: true,
displayPrimaryKey:false,//列表是否显示主键
allowEditing: false, //列表默认不可编辑
allowPaging:true,
allowSorting : true,
displayToolBar:false,
displayRowNumber :true,
rowNumberColWidth : 32,
displayColSplitLine: true,
pageSize : 20,
onload:_load,
entityContainer: gridEntityContainer
});
//重置toolBar按钮项
_resetToolBarItems();
me._hSplit.addControl(_dataGrid,1);
}
datagrid 数据获取值、重新复制、点击事件:
renderCell : function(p_item, $p_cell) {
var id = p_item.getValue("id");//获取值
//设置颜色
$p_cell.css({
"color" : "blue",
"cursor" : "pointer"
});
$p_cell.text(p_item.getValue("name"));//重新赋值
$p_cell.click(function() {//点击事件
me.controller.nameClick(id);
})
}