EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jaimi on December 30, 2013, 03:33:31 AM



Title: datagrid header
Post by: jaimi on December 30, 2013, 03:33:31 AM
Hello,

i'd like to create some kind of header in the datagrid.
I allready created the search fields and search function as shown within the demos and tutorial.

Now i'd like to paste some information at the header, for example aggregation of content which comes with the query result for the grid content itself.

How can i solve this?

thanks. Jaimi


Title: Re: datagrid header
Post by: stworthy on December 30, 2013, 06:24:55 PM
What do you mean the datagrid header? Is it the panel header or the column header? If it is the panel header, try the code below to get panel header object.
Code:
var header = $('#dg').datagrid('getPanel').panel('header');


Title: Re: datagrid header
Post by: jaimi on January 18, 2014, 12:50:15 AM
Thanks for the hint.

I tried the following as I did with the datagrid-pagination.
But it doesn't work. What's wrong?

var CurriculumVitaePager = $('#edgCurriculumVitae').edatagrid('getPager');   
 
 CurriculumVitaePager.pagination({
  showPageList: true,
  displayMsg  : '{from} bis {to} von {total} Einträgen',
  buttons     :[
   {iconCls:'icon-add'   ,handler:function(){addCurriculumVitae();}},
   {iconCls:'icon-edit'  ,handler:function(){editCurriculumVitae();}},
   {iconCls:'icon-remove',handler:function(){removeCurriculumVitae();}},
   {iconCls:'icon-save'  ,handler:function(){saveCurriculumVitae();}},
   {iconCls:'icon-undo'  ,handler:function(){undoCurriculumVitae();}}
  ]
 });//CurriculumVitaePager
 
 var CurriculumVitaePanel = $('#edgCurriculumVitae').edatagrid('getPanel').panel('header');
 
 $('#CurriculumVitaePanel').panel({
  width:500,
  height:150,
  title:'My Panel',
  tools:[{
  iconCls:'icon-add',
  handler:function(){alert('new')}
  },{
  iconCls:'icon-save',
  handler:function(){alert('save')}
  }]
 });//CurriculumVitaePanel


Title: Re: datagrid header
Post by: stworthy on January 18, 2014, 07:05:53 AM
The datagrid extends from panel. All the properties of panel can be used in datagrid. To apply tools to the datagrid header, create datagrid with 'tools' property definition.
Code:
$('#CurriculumVitaePanel').datagrid({
width:500,
height:150,
title:'My Panel',
tools:[{
iconCls:'icon-add',
handler:function(){alert('new')}
},{
iconCls:'icon-save',
handler:function(){alert('save')}
}]
});