EasyUI Forum

General Category => Bug Report => Topic started by: Pierre on August 23, 2016, 07:25:23 AM



Title: [SOLVED] DataGrid "fit" does not work
Post by: Pierre on August 23, 2016, 07:25:23 AM
Hello
if I send datagrid into DIV and if datagrid have fit="true", datagrid is not displayed.
Please take a look here:
http://code.reloado.com/oeasyrik1/37/edit#preview
if you remove fit="true", datagrid is loaded.
With other words, how to "fit" datagrid after loading into DIV?
Thank you.


Title: Re: DataGrid "fit" does not work
Post by: jarry on August 23, 2016, 07:59:15 AM
Please notice that you haven't set the 'height' property for your div(div_table). This will make the datagrid to be zero height. The updated example below works well.
http://code.reloado.com/oeasyrik1/38/edit#preview


Title: Re: DataGrid "fit" does not work
Post by: Pierre on August 23, 2016, 10:16:08 AM
Thank you but I don't know the height because DIV is declared inside layout, something like:

Code:
              <div class="easyui-layout" fit="true"> 
                  <div data-options="region:<39>west<39>,split:true" title="Title" style="width:500px" >
                     <div id="myTableDiv"></div>               
                  </div>
              </div>

Later I fill the "myTableDiv" with table. It works perfect when I declare table inside the layout, but when I use DIV and declare table later, "fit" does not work...
With other words, I never declare table height, I'm just use fit="true" but now I need to declare table later and I don't know how to declare table which will have same size as layout (table need to be also resized with layout).
Tahnk you.


Title: Re: DataGrid "fit" does not work
Post by: jarry on August 23, 2016, 06:58:01 PM
You just need to set 'height:100%' for the datagrid container. Please look at this example http://code.reloado.com/oeasyrik1/39/edit


Title: Re: DataGrid "fit" does not work
Post by: Pierre on August 23, 2016, 11:50:42 PM
Awesome, so simple solution, I should know ..  >:(
Thank you for your help ;D