Hi,
I am working on a dataGrid, which needs to be editable, and able to export CSV file.
so the columns this:
columns: [{command: ["edit"], title: " ", width: "100px"},
{field:"channelId", title: dict.channel,template:'#: channelList[(channelId-1)]#'},
{field:"campaignId", title:dict.campaign,editor: disabledEditor},
{field:"status", title:dict.status,template:'<span style="text-transform:lowercase">#: status#</span>'},
{field:"budget", title:dict.budget+' (USD)', type: "number",format: "{0:c2}"},
{field:"impressior", title:dict.impressior,type: "number"},
{field: "clcik", title:dict.click,type: "number"},
{field: "dailyBudget", title:dict.cost,type: "number",format: "{0:c}"},
{field: "conv", title:dict.conv,type: "number"},
{field: "avgPost", title:dict.avgPost,type: "number"},
{field: "ctr", title:dict.ctr,type: "number"},
{field: "cpc", title:dict.cpc,type: "number"},
{field: "cpa", title:dict.cpa,type: "number"}
],
I am using this method to export csv:
http://blog.falafel.com/Blogs/RachelHagerman/rachel-hagerman/2014/02/04/super-simple-spreadsheet-export-from-kendo-ui-grid
however, as I used 'template' in 'columns', the export CSV function crashed here:
if (value && template && exportFormat !== false) {
value = _.isFunction(template)
? template(data[row])
: kendo.template(template)(data[row]);
}
if I takes out 'template' from 'columns' and use 'rowTemplate' like this:
rowTemplate: '<tr data-uid="#= uid #"><td></td><td>#= channelList[(channelId-1)]#</td><td>#: campaignId#</td><td style="text-transform:lowercase">#: status#</td><td>#: budget#</td><td>#: impressior#</td><td>#: clcik#</td><td>#: dailyBudget#</td><td>#: conv#</td><td>#: avgPost#</td><td>#: ctr#</td><td>#: cpc#</td><td>#: cpa#</td></tr>',
the CSV export script works, but the edit button do not appear
I tried to put '<a class="k-button k-button-icontext k-grid-edit" href="#"><span class="k-icon k-edit"></span>Edit</a>' in the row template like this example
but still not working
Another problem is, the value of one of the field is number, but what needs to be display are string, refer to an Array, like this:
'#: channelList[(channelId-1)]#'
It only returns the number on the CSV
please help and thanks
I am working on a dataGrid, which needs to be editable, and able to export CSV file.
so the columns this:
columns: [{command: ["edit"], title: " ", width: "100px"},
{field:"channelId", title: dict.channel,template:'#: channelList[(channelId-1)]#'},
{field:"campaignId", title:dict.campaign,editor: disabledEditor},
{field:"status", title:dict.status,template:'<span style="text-transform:lowercase">#: status#</span>'},
{field:"budget", title:dict.budget+' (USD)', type: "number",format: "{0:c2}"},
{field:"impressior", title:dict.impressior,type: "number"},
{field: "clcik", title:dict.click,type: "number"},
{field: "dailyBudget", title:dict.cost,type: "number",format: "{0:c}"},
{field: "conv", title:dict.conv,type: "number"},
{field: "avgPost", title:dict.avgPost,type: "number"},
{field: "ctr", title:dict.ctr,type: "number"},
{field: "cpc", title:dict.cpc,type: "number"},
{field: "cpa", title:dict.cpa,type: "number"}
],
I am using this method to export csv:
http://blog.falafel.com/Blogs/RachelHagerman/rachel-hagerman/2014/02/04/super-simple-spreadsheet-export-from-kendo-ui-grid
however, as I used 'template' in 'columns', the export CSV function crashed here:
if (value && template && exportFormat !== false) {
value = _.isFunction(template)
? template(data[row])
: kendo.template(template)(data[row]);
}
if I takes out 'template' from 'columns' and use 'rowTemplate' like this:
rowTemplate: '<tr data-uid="#= uid #"><td></td><td>#= channelList[(channelId-1)]#</td><td>#: campaignId#</td><td style="text-transform:lowercase">#: status#</td><td>#: budget#</td><td>#: impressior#</td><td>#: clcik#</td><td>#: dailyBudget#</td><td>#: conv#</td><td>#: avgPost#</td><td>#: ctr#</td><td>#: cpc#</td><td>#: cpa#</td></tr>',
the CSV export script works, but the edit button do not appear
I tried to put '<a class="k-button k-button-icontext k-grid-edit" href="#"><span class="k-icon k-edit"></span>Edit</a>' in the row template like this example
but still not working
Another problem is, the value of one of the field is number, but what needs to be display are string, refer to an Array, like this:
'#: channelList[(channelId-1)]#'
It only returns the number on the CSV
please help and thanks