- 注册时间
- 2012-8-12
- 最后登录
- 2012-11-12
- 阅读权限
- 10
- 积分
- 140
- 精华
- 0
- 帖子
- 40
|
factory 发表于 2012-10-25 09:29
你把你的样式出错的datagrid页面上传下,我们看下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title><link href="css/demo.css" rel="stylesheet" type="text/css" />
<script src="scripts/boot.js" type="text/javascript"></script>
<style type="text/css">
.icon-ok, .icon-no
{
width: 16px;
height: 16px;
overflow: hidden;
margin: auto;
background: url(scripts/miniui/themes/icons/ok.png) no-repeat;
text-align: center;
display: block;
}
.icon-no
{
background: url(scripts/miniui/themes/icons/no.png) no-repeat;
}
</style>
</head>
<body style="font-size: 12px;">
<h1>
供应商任务启用/审核</h1>
<span id="sp_Data"><div style="width: 615px;"><div class="mini-toolbar" style="border-bottom: 0; padding: 0px;"><table style="width: 100%;"><tr><td style="width: 100%;"><a class="mini-button" iconcls="icon-save" onclick="saveData()" plain="true">保存</a></td></tr></table></div></div><div id="datagrid1" class="mini-datagrid" style="width: 615px; height: 280px;" allowresize="true" pagesize="20" allowcelledit="true" allowcellselect="true" url="data/AjaxServiceProj.aspx?method=GetTaskCrossSupData&proj_id=7a89b38c-7506-4a3e-bb8b-70f7c9aaf5dc&phase_id=405363a9-2c21-4fbf-a5e7-0cfec25da653&node_id=0a980a60-cfa8-4f62-b314-23e7225093b9" multiselect="true" allowcellvalid="true" oncellvalidation="onCellValidation" onload="onLoad"><div property="columns"><div type="checkcolumn"></div><div name="Sup_ID" field="Sup_ID" width="100" headeralign="center">名称</div><div header="工装(样品)认可证" align="center" headerAlign="center"><div property="columns"><div field="25e9c71c-659b-46de-9591-61ffcf43b205@工装(样品)认可证" vtype="required" width="80" renderer="onGenderRenderer" align="center" headerAlign="center">是否提交<input property="editor" class="mini-combobox" style="width:100%;" data="IsEnable"/></div><div field="25e9c71c-659b-46de-9591-61ffcf43b205" name="state" width="80" align="center" headerAlign="center">状态</div></div></div><div header="工装样件材料采购及交样需求表" align="center" headerAlign="center"><div property="columns"><div field="fea6c571-8ea5-45e8-a05b-9576291c5e9d@工装样件材料采购及交样需求表" vtype="required" width="80" renderer="onGenderRenderer" align="center" headerAlign="center">是否提交<input property="editor" class="mini-combobox" style="width:100%;" data="IsEnable"/></div><div field="fea6c571-8ea5-45e8-a05b-9576291c5e9d" name="state" width="80" align="center" headerAlign="center">状态</div></div></div><div header="样件签署" align="center" headerAlign="center"><div property="columns"><div field="1862a160-7583-49cd-bd44-e92982e7077f@样件签署" vtype="required" width="80" renderer="onGenderRenderer" align="center" headerAlign="center">是否提交<input property="editor" class="mini-combobox" style="width:100%;" data="IsEnable"/></div><div field="1862a160-7583-49cd-bd44-e92982e7077f" name="state" width="80" align="center" headerAlign="center">状态</div></div></div></div></div></span>
<script type="text/javascript">
mini.parse();
var grid = mini.get("datagrid1");
if (grid != undefined) {
grid.load();
}
var IsEnable = [{ id: 0, text: '启用' }, { id: 1, text: '禁用'}];
function onGenderRenderer(e) {
for (var i = 0, l = IsEnable.length; i < l; i++) {
var g = IsEnable;
if (g.id == e.value) return g.text;
}
return "";
}
function saveData() {
var data = grid.getChanges();
var json = mini.encode(data);
grid.loading("保存中,请稍后......");
$.ajax({
url: "data/AjaxService.aspx?method=SaveTaskCrossSupData",
data: { data: json },
type: "post",
success: function (text) {
grid.reload();
},
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
}
});
}
function onCellValidation(e) {
if (e.field == "End_Date") {
if (e.value == 0) {
e.isValid = false;
e.errorText = "不能为空";
}
}
}
if (grid != undefined) {
grid.on("drawcell", function (e) {
var record = e.record,
column = e.column,
field = e.field,
value = e.value;
if (column.name == "state") {
if (e.value == 0) {
e.cellHtml = ""
}
else if (e.value == 1) {
e.cellHtml = "<span class=\"icon-no\" onclick=\"edit('" + field + "')\"></span>"
}
else {
e.cellHtml = "<span class=\"icon-ok\" onclick=\"edit('" + field + "')\"></span>"
}
}
});
}
function edit(sup_id) {
var row = grid.getSelected();
if (row) {
mini.open({
url: "PM_Proj_Task_Edit_Prod.html",
title: "供应商任务审核", width: 950, height: 450,
onload: function () {
var iframe = this.getIFrameEl();
var data = { action: "edit", sup_id: sup_id, id: row.id };
iframe.contentWindow.SetData(data);
},
ondestroy: function (action) {
grid.reload();
}
});
} else {
alert("请选中一条记录");
}
}
function onLoad(e) {
var grid = e.sender;
var marges = [
{ rowIndex: 0, columnIndex: 2, rowSpan: 1, colSpan: 2 }
];
grid.margeCells(marges);
}
</script>
</body>
</html>
|
|