EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: thecyberzone on July 24, 2015, 09:28:10 AM



Title: Background image of Treegrid/Datagrid
Post by: thecyberzone on July 24, 2015, 09:28:10 AM
I want to display an image as background of a Treegrid / Datagrid, How it can be done? Any help ...


Title: Re: Background image of Treegrid/Datagrid
Post by: stworthy on July 24, 2015, 06:13:40 PM
Get the datagrid panel and you can add any CSS style on it.
Code:
var p = $('#dg').datagrid('getPanel');
p.css('background',...);


Title: Re: Background image of Treegrid/Datagrid
Post by: thecyberzone on July 24, 2015, 11:49:31 PM
I have already tried as follows, but nothing happens.  :(

Code:
<script>
var p = $('#dg').datagrid('getPanel');
p.css('background',url('images/main.jpg'));
</script>


Title: Re: Background image of Treegrid/Datagrid
Post by: stworthy on July 25, 2015, 12:12:45 AM
Make sure your image can be accessed from your page. Please refer to http://jsfiddle.net/du3eu6g1/


Title: Re: Background image of Treegrid/Datagrid
Post by: thecyberzone on July 25, 2015, 08:27:06 AM
It works! Problem was it should be under onload of page.