EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: siroccoicode on August 05, 2014, 08:58:26 PM



Title: Datagrid "onLoadSuccess" fires twice
Post by: siroccoicode on August 05, 2014, 08:58:26 PM
I found  when datagrid was loaded,the onLoadSuccess event fired twice.
Code:
<script type="text/javascript">
$('#test').datagrid({
url:'datagrid_data1.json',
method:'get',
onLoadSuccess:function(data){
alert(1);
$('.datagrid-header td:contains(de)').click(function(){
alert(2);
});
}
});
</script>
When I refresh page, the output displays "1" twice.
why? In my mind, onLoadSuccess event should fire only once.


Title: Re: Datagrid "onLoadSuccess" fires twice
Post by: siroccoicode on August 05, 2014, 10:53:53 PM
 ;D
I has solved it. Because I declared this datagrid in the  HTML<body> ,and I append  some new attributes  for datagrid in the javascript ,so this datagrid  is reloaded.
My solution is : throw them into $(function),then all are OK! ;D