jQuery MiniUI
标题:
miniui
[打印本页]
作者:
小葱儿
时间:
2013-8-27 15:40:51
标题:
miniui
你好,我想知道,我在miniui控件里面根据条件循环的向datagrid 的一个控件里面放入html input 标签 那对于这些个input 标签的变换或者是删除,我该怎么处理呢,谢谢
作者:
factory
时间:
2013-8-27 16:09:06
向datagrid 的一个控件里面放入html input 标签
这句不是太理解,具体是往什么控件里放入?放入什么
作者:
小葱儿
时间:
2013-8-27 16:55:12
function ondrawcell(e) {
if (e.field == "shijianduan") {
var moshiid = e.row.ScheduleID;
if (getnumbersbyid(moshiid) == e.row.shijiannumber) {
// tempDiv = getjsons(moshiid);
var times = getmyjsonsbyid(moshiid);
var tempDiv = "<table>";
var html = "";
for (var i = 0; i < times.length; i++) {
//mini.mini.formatDate(dateObj, "HH:mm")
html += "<tr><td><input class='myinput' id=ScheduleID" + i + "0 type='text' value='" + mini.formatDate(times.endtime, 'HH:mm') + "'/></td><td><input class='myinput' id=ScheduleID" + i + "1 type='text' value='" + mini.formatDate(times.endtime, 'HH:mm') + "'/></td></tr>";
// html += "<tr><td><input class='myinput' id=" + i + "0 type='text' value='" + 12 + "'/></td><td><input class='myinput' id=" + i + "1 type='text' value='" + 12 + "'/></td></tr>";
}
tempDiv += html;
tempDiv += "</table>"
e.cellHtml = tempDiv;
return
}
else {
var tempDiv = "<table>";
var html = "";
for (var i = 0; i < e.row.shijiannumber; i++) {
html += "<tr><td><input class='myinput' id=" + i + "0 type='text' /></td><td><input class='myinput' id=" + i + "1 type='text' /></td></tr>";
}
tempDiv += html;
tempDiv += "</table>"
e.cellHtml = tempDiv;
return;
}
}
}
//获取所有的input标签的值;
var inputLen=$(".myinput").length;
for (var i = 0; i < inputLen; i++) {
var name = $(".myclass:eq(i)").val();
// $(.myinput:eq(3)).value;
}
//通过模式id找到该id下所对应的时间详情;
var jsons;
function getjsons() {
$.ajax({
url: "DataServices.aspx?method=getjsons",
type: "post",
success: function (result) {
myjsons = mini.decode(result);
jsons = myjsons
// return jsons;
},
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
}
});
return jsons;
}
// jsons = getjsons();
// mytimejsons = jsons.timedata;
function getmyjsonsbyid(ScheduleID) {
var jsons = getjsons();
var mytimejsons = jsons.timedata;
var lists=[];
for (var i = 0; i < mytimejsons.length; i++) {
if (mytimejsons.ScheduleID == ScheduleID) {
//
lists.add(mytimejsons);
}
}
return lists;
}
// //通过时间id找到该id下面所对应的时间段个数
// function getnumbers() {
// $.ajax({
// url: "DataServices.aspx?method=getnumbers",
// success: function (result) {
// DicValueList = mini.decode(result);
// return DicValueList;
// },
// error: function (jqXHR, textStatus, errorThrown) {
// alert(jqXHR.responseText);
// }
// });
// }
// DicValueList = getnumbers();
// DicValueList = jsons.number;
function getnumbersbyid(ScheduleID) {
var jsons = getjsons();
var DicValueList = jsons.number;
for (var i = 0; i < DicValueList.length; i++) {
if (DicValueList.ScheduleID == ScheduleID) {
// alert(DicValueList.shijiannumber);
return (DicValueList.shijiannumber);
}
}
}
function search() {
var key = mini.get("key").getValue();
grid.load({ key: key });
}
function onKeyEnter(e) {
search();
}
function addRow() {
var newRow = { ScheduleName: "未定义" };
grid.addRow(newRow, 0);
}
function removeRow() {
var rows = grid.getSelecteds();
if (rows.length > 0) {
grid.removeRows(rows, true);
}
else {
alert("请选中一条记录");
}
}
function saveData() {
//检查数据是否变动
var data = grid.getChanges();
if (data.length == 0)
return;
//验证数据是否合法
grid.validate();
if (!grid.isValid()) {
mini.showMessageBox({
showHeader: false,
width: 250,
buttons: ["ok"],
message: "数据输入不合法,请检查!",
iconCls: "mini-messagebox-error"
});
return;
}
var json = mini.encode(data);
grid.loading("保存中,请稍后......");
$.ajax({
url: "DataServices.aspx?method=SaveMoshigaunli",
data: { data: json },
type: "post",
success: function (text) {
grid.reload();
},
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
}
});
}
</script>
</head>
<body>
<h1>
CellEdit 排班模式管理</h1>
<div style="width: 800px;">
<div class="mini-toolbar" style="border-bottom: 0; padding: 0px;">
<table id="maintable" style="width: 100%;">
<tr>
<td style="width: 100%;">
<a class="mini-button" iconcls="icon-add" plain="true">增加</a>
<a class="mini-button" iconcls="icon-remove" plain="true">删除</a>
<span class="separator"></span><a class="mini-button" iconcls="icon-save"
plain="true">保存</a>
</td>
</tr>
</table>
</div>
</div>
<div id="datagrid1" class="mini-datagrid" style="width: 800px; height: 280px;" url="DataServices.aspx?method=ProcesRequest"
idfield="ScheduleID" allowresize="true" pagesize="20" allowcelledit="true" allowcellselect="true"
multiselect="true" editnextonenterkey="true">
<div property="columns">
<div type="indexcolumn">
</div>
<div type="checkcolumn">
</div>
<div field="ScheduleName" width="120" headeralign="center" allowsort="true">
模式名称
<input property="editor" class="mini-textbox" style="width: 100%;" />
</div>
<div field="ScheduleID" width="1" headeralign="center" allowsort="true">
模式id
<input property="editor" class="mini-textbox" style="width: 100%;" />
</div>
<div type="comboboxcolumn" autoshowpopup="true" name="gender" field="shijiannumber"
width="100" allowsort="true" headeralign="center">
模式时间段个数
<input id="combo1" property="editor" class="mini-combobox" textfield="text" valuefield="id"
style="width: 100%;" data="Genders" />
</div>
<div name="birthday" field="shijianduan" width="220" allowsort="true" dateformat="yyyy-MM-dd">
时间段详情
</div>
</div>
</div>
</body>
</html>
这个问题真的是难死我了,我想把我前面自动生成的input 保存的时候获取input 的各项值
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2