jquery easyui dynamically created tabs to refresh contained iframe everytime the icon-class is clicked -
i have next tree building tabs dynamically. tabs having iframe source taken json file:
<script type="text/javascript"> $(function(){ $('#tree_menu').tree({ animate:true, onclick: function open1(node){ if ($('#tabs').tabs('exists',node.id)){ $('#tabs').tabs('select', node.id); } else { $('#tabs').tabs('add',{ title: node.id, content: "<iframe id='superframe' frameborder='0' width='100%' scrolling='auto' height='99%' src='" + node.attributes.url + "'><iframe>", closable:true, tools:[{ iconcls:'icon-mini-refresh', handler:function(){ alert('refreshing'); $('#superframe').get(0).contentwindow.location.reload(); } }] }); } } }); $('#tabs').tabs({ onbeforeclose: function(title){ homecoming confirm('are sure want close ' + title); } }); }); </script>
what want accomplish on tab icon-mini-refresh clicked, reload iframe in specific tab. above code, i'm able this, works first opened tab. starting sec not working anymore. not refreshing.... i've tried possible iframe reload methods found on google, without success.
can please help me this? lot!
id of iframe should unique accomplish this, please seek below code,
<script type="text/javascript"> $(function(){ $('#tree_menu').tree({ animate:true, onclick: function open1(node){ if ($('#tabs').tabs('exists',node.id)){ $('#tabs').tabs('select', node.id); } else { var frameid='superframe'+node.id; $('#tabs').tabs('add',{ title: node.id, content: "<iframe id='"+frameid+"' frameborder='0' width='100%' scrolling='auto' height='99%' src='" + node.attributes.url + "'><iframe>", closable:true, tools:[{ iconcls:'icon-mini-refresh', handler:function(){ alert('refreshing'); $('#'+frameid).get(0).contentwindow.location.reload(); } }] }); } } }); $('#tabs').tabs({ onbeforeclose: function(title){ homecoming confirm('are sure want close ' + title); } }); }); </script>
jquery jquery-easyui
No comments:
Post a Comment