Title: Dynamic Column Group
Post by: sky-t on August 30, 2020, 11:42:05 PM
Hi there,
i generate a datagrid complete dynamicly. I need to column some header cells as colspan - how can i achieve this?
Thanks
Title: Re: Dynamic Column Group
Post by: jarry on September 01, 2020, 12:08:31 AM
Please refer to the code below: $('#dg').datagrid({ columns: [ [ {field:'productid',title:'Product',width:100,rowspan:2}, {title:'Details',colspan:4} ], [ {field:'listprice',title:'List Price',width:100}, {field:'unitcost',title:'Unit Cost',width:100}, {field:'attr1',title:'Attribute',width:200}, {field:'status',title:'Status',width:100} ] ] })
Title: Re: Dynamic Column Group
Post by: sky-t on September 01, 2020, 03:55:47 AM
Hi jarry, thank you for your reply. Who can do this if i use this code: var columns = $('#tableTimesheet').datagrid('options').columns; columns[0]=[];
for (var i=0; i < (duration + 1); i++) { if (typeof currentdate === 'undefined') { var currentdate=new Date(); } var currenttime=new Date(starttime.valueOf()); currenttime.setMinutes(currenttime.getMinutes() + (i * timescale));
if (currenttime.getHours() < 8) continue; if (currenttime.getHours() > 18) continue; if (currenttime.getHours() >= 18 && currenttime.getMinutes() > 0) continue;
currenttime=getHumanTime(currenttime, false)
columns[0].push({ field: '' + i + '', title: currenttime, width:'40px', align:'center', styler: function(value,row,index){ return {class:'td_cell',style:'color:red'} } }); }
var row=''; row+='<tr>'; row+='<td>'; row+=surname.value + ', ' + prename.value; row+='</td>'; row+='</tr>'; $('#tableTimesheet > tbody:last').append(row);
for (var i=0; i < 15; i++) { var row=''; row+='<tr>'; row+='<td>'; row+=i; row+='</td>'; row+='</tr>'; $('#tableTimesheet > tbody:last').append(row); }
$('#tableTimesheet').datagrid(); }
Title: Re: Dynamic Column Group
Post by: sky-t on September 05, 2020, 12:01:52 AM
anybody an idea for this challenge?
Title: Re: Dynamic Column Group
Post by: jarry on September 06, 2020, 02:51:09 AM
Please refer to this example http://code.reloado.com/aliyar3/edit#preview
|