EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Pierre on October 05, 2013, 01:53:51 AM



Title: [SOLVED] How to delete controls?
Post by: Pierre on October 05, 2013, 01:53:51 AM
Hi all
I need to remove toolbar buttons (see image).
Here is HTML:

    <div data-options="region:'west',tools:'#tasks_tb',split:true" title="Tasks">
      <table id="member_tasks_calendar" ...
      ...  
      </table>
      <div id="tasks_tb">
        <a href="javascript:void(0)" class="icon-insert" title="Insert"></a>
        <a href="javascript:void(0)" class="icon-change" title="Change"></a>
        <a href="javascript:void(0)" class="icon-delete" title="Delete"></a>
        <a href="javascript:void(0)" class="icon-reload" title="Reload"></a>
      </div>

Now I need to delete the buttons (under some conditions).
I try this:
  $('#tasks_tb').remove();
or this:
  var tb = document.getElementById( 'tasks_tb' );
  tb.parentNode.removeChild( tb );  

and it does not worked.
Thanks.

Solution:
    var c = $('#members_layout');                // layout object
    var w = c.layout('panel','west');              // get panel
    w.panel('header').html('<b>New header text</b>');


Title: Re: [SOLVED] How to delete controls?
Post by: stworthy on October 05, 2013, 05:35:29 PM
Add a class 'pt' to every tools, so it will be easy to search all these tools and remove them.
Code:
<div id="tasks_tb">
<a href="javascript:void(0)" class="pt icon-insert" title="Insert"></a>
<a href="javascript:void(0)" class="pt icon-change" title="Change"></a>
<a href="javascript:void(0)" class="pt icon-delete" title="Delete"></a>
<a href="javascript:void(0)" class="pt icon-reload" title="Reload"></a>
</div>

To remove these tools, simply call $('.pt').remove().


Title: Re: [SOLVED] How to delete controls?
Post by: Pierre on October 06, 2013, 01:04:52 PM
Thank you master, works perfect!