EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Aod47 on October 16, 2019, 11:35:13 PM



Title: How to add easyui panel into div (normal div)?
Post by: Aod47 on October 16, 2019, 11:35:13 PM
It's sound like easy but I can't do that.  ???

Could you please advice? Thank you.

Code:
<div id="Div1">
   
</div>

<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="addPanel()">Add Panel</a>

<script>
function addPanel() {

            var pp = $('#pp').panel({
                width: 500,
                height: 150,
                title: 'My Panel',
                tools: [{
                    iconCls: 'icon-add',
                    handler: function() { alert('new') }
                        }, {
                    iconCls: 'icon-save',
                    handler: function() { alert('save') }
                    }]
                });

            $("#Div1").append(pp);
                 
  }
</script>



Title: Re: How to add easyui panel into div (normal div)?
Post by: Aod47 on October 17, 2019, 05:45:32 PM
I got it! very easy ;D


Code:
function addPanel() {
           
            $('<div id="pp"></div>').appendTo('#Div1');
           
            $('#pp').panel({
                width: 500,
                height: 150,
                title: 'My Panel',
                tools: [{
                    iconCls: 'icon-add',
                    handler: function() { alert('new') }
                        }, {
                    iconCls: 'icon-save',
                    handler: function() { alert('save') }
                    }]
                });
}