jQuery MiniUI
标题:
grid.showRowDetail 问题
[打印本页]
作者:
MiniFans
时间:
2014-12-18 16:38:37
标题:
grid.showRowDetail 问题
:) MiniUI的程序员,您好:
<script type="text/javascript">
$(function () {
mini.parse();
var data = new Array();
var item1 = {};
item1["col1"] = "C11";
item1["col2"] = "C12";
item1["col3"] = [{ "t1": "Testa", "t2": "Testb" }, { "t1": "Testc", "t2": "Testd"}];
var item2 = {};
item2["col1"] = "C21";
item2["col2"] = "C22";
item2["col3"] = [{ "t1": "TestA", "t2": "TestB" }, { "t1": "TestC", "t2": "TestD"}];
data.push(item1);
data.push(item2);
mini.get("datagrid1").setData(data);
});
function onShowRowDetail(e) {
var grid = e.sender;
var row = e.record;
var dataSource = row["col3"];
var td = grid.getRowDetailCellEl(row);
mini.get("datagridDetail").setData(dataSource);
$("div#datagridDetailContainer").show();
td.innerHTML = "";
$("div#datagridDetailContainer").appendTo(td);
}
function reBindData() {
var data = new Array();
var item1 = {};
item1["col1"] = "C111";
item1["col2"] = "C112";
item1["col3"] = [{ "t1": "Testaa", "t2": "Testbb" }, { "t1": "Testcc", "t2": "Testdd"}];
var item2 = {};
item2["col1"] = "C221";
item2["col2"] = "C222";
item2["col3"] = [{ "t1": "TestAA", "t2": "TestBB" }, { "t1": "TestCC", "t2": "TestDD"}];
data.push(item1);
data.push(item2);
mini.get("datagrid1").setData(data);
}
</script>
<body>
<span style="color:Blue;" onclick="reBindData();">ReSetData</span>
<div id="datagrid1" class="mini-datagrid" style="width:700px;height:auto;" onshowrowdetail="onShowRowDetail" autoHideRowDetail="true">
<div property="columns">
<div type="expandcolumn"></div>
<div type="indexcolumn" ></div>
<div field="col1">Col1</div>
<div field="col2">Col2</div>
</div>
</div>
<div id="datagridDetailContainer" style="display:none;">
<div id="datagridDetail" class="mini-datagrid" style="height:auto;" showpager="false">
<div property="columns">
<div type="indexcolumn" ></div>
<div field="t1">T1</div>
<div field="t2">T2</div>
</div>
</div>
</div>
</body>
问题是这样的,在展开DetailRow之后,再次为Grid做setData动作,在这之后,DetailRow就不可见了。。
是俺的调用方法问题吗?求助 :)
作者:
dforce
时间:
2014-12-18 17:01:50
第一次展开后那个明细表就添加到了表格下
你重新赋值的时候,前面表格下的数据和子表格都被删掉了
这个 $("div#datagridDetailContainer")都没了,再次打开的时候肯定也就没了
你可以用动态生成的方式添加子表格
作者:
MiniFans
时间:
2014-12-18 17:15:58
dforce 发表于 2014-12-18 17:01
第一次展开后那个明细表就添加到了表格下
你重新赋值的时候,前面表格下的数据和子表格都被删掉了
这个 $(" ...
对!一语点醒梦中人,多谢!:)
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2