EasyUI Forum
March 29, 2024, 01:43:49 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 I do this  (Read 8627 times)
catpaw
Jr. Member
**
Posts: 85


View Profile Email
« on: April 16, 2015, 01:46:59 PM »

hello!!

in the demo section http://jeasyui.com/demo/main/index.php?plugin=DataGrid

the Column Group example says:

to declare table like this:

Code:
<table class="easyui-datagrid" title="Column Group" style="width:700px;height:250px"
            data-options="rownumbers:true,singleSelect:true,url:'datagrid_data1.json',method:'get'">
        <thead>
            <tr>
                <th data-options="field:'itemid',width:80" rowspan="2">Item ID</th>
                <th data-options="field:'productid',width:100" rowspan="2">Product</th>
                <th colspan="4">Item Details</th>
            </tr>
            <tr>
                <th data-options="field:'listprice',width:80,align:'right'">List Price</th>
                <th data-options="field:'unitcost',width:80,align:'right'">Unit Cost</th>
                <th data-options="field:'attr1',width:240">Attribute</th>
                <th data-options="field:'status',width:60,align:'center'">Status</th>
            </tr>
        </thead>
    </table>

but I need do it on this way:

Code:
$('#dg').datagrid({
    url:'datagrid_data.json',
    columns:[[
        {field:'code',title:'Code',width:100},
        {field:'name',title:'Name',width:100},
        {field:'price',title:'Price',width:100,align:'right'}
    ]]
});

how can I write the code, to agroup the columns??

thank you
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: April 16, 2015, 05:46:45 PM »

Please try this:
Code:
$('#dg').datagrid({
    columns:[[
        {field:'itemid',title:'Item ID',width:80,rowspan:2},
        {field:'productid',title:'Product',width:100,rowspan:2},
        {title:'Item Details',colspan:3}
    ],[
        {field:'code',title:'Code',width:100},
        {field:'name',title:'Name',width:100},
        {field:'price',title:'Price',width:100,align:'right'}
    ]]

})
Logged
catpaw
Jr. Member
**
Posts: 85


View Profile Email
« Reply #2 on: April 16, 2015, 06:11:50 PM »

thaks stworthy that works

I imagine that data should go with Same Structure, right?
Logged
vencelylalas
Newbie
*
Posts: 7


View Profile WWW Email
« Reply #3 on: April 24, 2015, 10:53:32 PM »

yes it do works..
thanks for sharing such good source of codes for us..
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!