easyui onloadsucess方法

together14629 2013-03-02 11:05:08
<table id="dg" class="easyui-datagrid" title="Messages more than 90 days old will be removed automatically." style="width:760px;height:250px">
</table>
<script type="text/javascript">
$(function(){
$("#dg").datagrid({
url:"../ashx/userInquirys.ashx",
singleSelect:true,
pagination: true,
pageSize:20,
rownumbers: true,
onLoadSuccess:function(data){
var panel = $(this).datagrid('getPanel');
var tr=panel.find(".datagrid-view2 tr");
alert(tr.length);
tr.each(function(){
var subject= $(this).children('td[field="f_subject"]').children("div");
var isview = $(this).children('td[field="f_isview"]');
if(isview.text()=="1")
{
var html=subject.html();
subject.html(html+"<font color='red'>New</font>");
}
});
}
</script>
运行之后 跳出了两次对话框 也就是onLoadSuccess方法执行了两次
虽然不影响结果 但是为什么会这样呢
在此谢过
...全文
280 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
together14629 2013-03-02
  • 打赏
  • 举报
回复
引用 1 楼 Mackz 的回复:
因为调用了两次$("#dg").datagrid()去构造表格!第一次是解析css,第二次是你的代码。去掉其中一次即可。
呃 刚接触easyui 边看demo边做 不知道有这回事
菜牛 2013-03-02
  • 打赏
  • 举报
回复
因为调用了两次$("#dg").datagrid()去构造表格!第一次是解析css,第二次是你的代码。去掉其中一次即可。

87,991

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧