EasyUI Forum
May 09, 2024, 01:44:43 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to add combobox to toolbar of datagrid with programming instead of html tag  (Read 13689 times)
zzdfc
Jr. Member
**
Posts: 58


View Profile
« on: January 09, 2012, 06:03:09 AM »

How to add combobox to toolbar of datagrid with  programming instead of html tag?
« Last Edit: January 09, 2012, 07:49:05 AM by zzdfc » Logged
Kevin
Jr. Member
**
Posts: 52


View Profile Email
« Reply #1 on: May 07, 2012, 04:07:07 AM »

I was also wondering how to do this but the answer is quite easy (of course there could be other ways to do this). I just mixed the 2 methods. I added the Toolbar part via HTML and the rest via JavaScript. For example;

Javascript Part
$('#dg').datagrid({
   fit: true,
   idField: 'date',
   columns: [[
      { field: 'date', title: 'Date', width: 80 },
      { field: 'desc', title: 'Description', width: 300 },
      { field: 'amount', title: 'Amount', width: 800, align: 'right'}
   ]]
});

HTML Part
<table id="dg" toolbar="#toolbar" ></table>
<div id="toolbar">
   <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">Edit</a>
   <a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="save()">Save</a>
   <label>Select Option:</label>
   <select id="selection">
      <option value="1">Option1</option>
      <option value="2">Option2</option>
      <option value="3">Option3</option>
   </select>
</div>

Adding a seperator is also pretty easy via HTML but you need to add the following style to the anchor tags (as per the example above);  style="float: left;"
Thus the a tags would read;
<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()" style="float: left;">Edit</a>
<a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true" onclick="save()" style="float: left;">Save</a>

Now just insert the following code where you want the seperator to appear;
<div class="datagrid-btn-separator"></div>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!