EasyUI Forum
May 08, 2024, 05:14:08 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: custom datagrid header [solved]  (Read 10743 times)
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« on: May 24, 2015, 08:53:31 PM »

hello again.

i have a simple question, but may be a bit difficult for to do that.
 
if it possible to make datagrid header format like this ?:
___________________________________
             |            column band             |
header 1 |----------------------------------  |
             | col 1     | col 2       | col 3      |
             |----------------------------------  |
             |sub col 1 | sub col 2 | sub col 3|
-----------------------------------------------

i already try to make datagrid achieve just like that, but the result not as expected.

here my code:

Code:
list_data.datagrid({
      // url: "#{sc_load_data_audit_trials_path(:prm => params[:prm])}",
      method: "get",
      fit: true,
      title: "Audit Trails",
      idField: "id",
      toolbar: "#tb_list_data",
      resizeHanlde: "right",
      striped: true,
      rownumbers: true,
      frozenColumns: [
        [{field: 'field_name', title: "Field Name / State", width: 150, sortable: false, halign: 'left', align: 'center', rowspan: 2}],
        []
      ],
      columns: [
        [
          [{title: 'test 1', colspan: 3, halign: 'center'}],
          [
            {field: 'test1', title: 'test1', colspan: 1},
            {field: 'test2', title: 'test1', colspan: 1},
            {field: 'test3', title: 'test1', colspan: 1}
          ]
        ],
        [
          {field: 'test1', title: 'test1'},
          {field: 'test2', title: 'test1'},
          {field: 'test3', title: 'test1'}
        ]
      ]
    });
           

thanks in advance
« Last Edit: May 25, 2015, 07:44:59 PM by Opan Mustopah » Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: May 25, 2015, 12:18:39 AM »

Please try this:
Code:
$('#dg').datagrid({
    frozenColumns: [
        [{field: 'field_name', title: "Field Name / State", width: 150, sortable: false, halign: 'left', align: 'center'}]
    ],
    columns: [
        [
            {title: 'column band', colspan: 3, halign: 'center'}
        ],
        [
            {title: 'col 1', colspan: 1},
            {title: 'col 2', colspan: 1},
            {title: 'col 3', colspan: 1}
        ],
        [
            {field: 'test1', title: 'sub col 1'},
            {field: 'test2', title: 'sub col 2'},
            {field: 'test3', title: 'sub col 3'}
        ]
    ]

})
Logged
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #2 on: May 25, 2015, 12:35:32 AM »

thanks stworthy for your fast response.
one more question, can i make that header column colorize? specially for those sub column header ?
thanks in advance
Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: May 25, 2015, 12:56:27 AM »

Please refer to http://www.jeasyui.com/forum/index.php?topic=3854.0
Logged
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #4 on: May 25, 2015, 12:59:12 AM »

thanks again stworthy for your fast response, i'll try it asap.
Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
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!