jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Export Excel problem i need help please
Tagged: excel
This topic contains 4 replies, has 2 voices, and was last updated by Inverse 11 years, 4 months ago.
-
Author
-
export excel after my ‘paymentmode’ and ‘intogoodsmode’ is no show this ‘cellsrenderer’.
only sql value.
How can I do to make ‘cellsrenderer’ Show IN EXCEL
Please help me~cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { if (value == 0) { return "RED"; } else { return "GREEN"; }
cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { if (value == 1) { return "Bruce"; } else if(value == 2) { return "Peter"; } else if(value == 3) { return "Mary"; } else if(value == 4) { return "test1"; } else if(value == 0) { return "test2"; }
<script type="text/javascript"> $(document).ready(function () { // prepare the data var theme = 'arctic'; var source = { datatype: "json", datafields: [ { name:'id', type: 'string'}, { name:'paymentmode', type: 'string'}, { name:'intogoodsmode', type: 'string'}, { name:'payment_amount', type: 'string'}, { name:'username', type: 'string'}, { name:'payment_time', type: 'date'}, ], url: 'data1.php', root: 'Rows', }; $("#customersGrid").jqxGrid( { width: 770, height:300, source: dataAdapter, showfilterrow: true, filterable: true, pageable: true, autoheight: false, selectionmode: 'checkbox', theme: theme, localization: getLocalization(), keyboardnavigation: false, columns: [ { text: '付款單號', datafield: 'id', width: 100 }, { text: '銀行帳戶', datafield: 'intogoodsmode', width: 100, cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { if (value == 1) { return "Bruce"; } else if(value == 2) { return "Peter"; } else if(value == 3) { return "Mary"; } else if(value == 4) { return "test1"; } else if(value == 0) { return "test2"; } } }, { text: '付款方式', datafield: 'paymentmode', width: 100, cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) { if (value == 0) { return "RED"; } else { return "GREEN"; } } }, { text: '付款總金額', datafield: 'payment_amount', width: 130 }, { text: '付款人員', datafield: 'username', width: 140 }, { text: '付款時間', datafield: 'payment_time', cellsformat: 'yyyy-MM-dd', filtertype: 'date', width: 200 }, ] }); // Orders Grid // prepare the data var dataFields = [ { name:'id', type: 'string'}, { name: 'IN', type: 'string'}, { name: 'name', type: 'string'}, { name:'invoice_number', type: 'string'}, { name: 'total', type: 'number'}, { name:'create_time', type: 'string'}, ]; var source = { datatype: "json", datafields: dataFields, url: 'data.php', root: 'Rows', }; var dataAdapter = new $.jqx.dataAdapter(source); dataAdapter.dataBind(); $("#customersGrid").on('rowselect', function (event) { var ID = event.args.row.id; var records = []; var length = dataAdapter.records.length; for (var i = 0; i < length; i++) { var record = dataAdapter.records[i]; if (record.id == ID) { records[records.length] = record; } } var dataSource = { datafields: dataFields, localdata: records, } var adapter = new $.jqx.dataAdapter(dataSource); // update data source. $("#ordersGrid").jqxGrid({ source: adapter }); }); $("#ordersGrid").jqxGrid( { width: 770, height: 250, source: dataAdapter, keyboardnavigation: false, showstatusbar: true, statusbarheight: 25, altrows: true, columns: [ // { text: 'Shipped Date', datafield: 'ShippedDate', cellsformat: 'yyyy-MM-dd', width: 200 }, // { text: '付款單號', datafield: 'id', width: 100 }, { text: '進貨單號', datafield: 'IN', width: 100}, { text: '公司名稱', datafield: 'name', width: 270}, { text: '發票編號', datafield: 'invoice_number', width: 130, }, { text: '創建時間', datafield: 'create_time', width: 170, }, { text: '進貨金額', datafield: 'total', cellsalign: 'right', cellsformat: 'c2', aggregates: ['<b>Total</b>'] } ] }); $("#excelExport").jqxButton({ theme: theme }); $("#excelExport").click(function () { $("#customersGrid").jqxGrid('exportdata', 'xls', 'jqxGrid'); }); }); </script>
Hi Inverse,
cellsrenderer result is not exported. The Grid Exports the Cells Values.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comthank you~!
No other way?
Want to make him able to specify the text presented in EXCEL
Hi Inverse,
If the loaded data into the Grid contains the values which you have to export, the Grid will export them. However, custom HTML rendered through the “cellsrenderer” function is not possible to be exported.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comthank you Peter Stoev!
I think other methods~
-
AuthorPosts
You must be logged in to reply to this topic.