首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

easyui onloadsucess步骤

2013-03-04 
easyui onloadsucess方法table iddg classeasyui-datagrid titleMessages more than 90 days old

easyui onloadsucess方法
<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方法执行了两次
虽然不影响结果 但是为什么会这样呢
在此谢过 easyui?
[解决办法]
因为调用了两次$("#dg").datagrid()去构造表格!第一次是解析css,第二次是你的代码。去掉其中一次即可。

热点排行