jQWidgets Forums
jQuery UI Widgets › Forums › Grid › export to xls converts string to date
This topic contains 2 replies, has 2 voices, and was last updated by Martin 6 years, 4 months ago.
Viewing 3 posts - 1 through 3 (of 3 total)
-
Author
-
Hi guys,
I have this one working. I have just noticed that data in string format is converted to date when you export it to xls format.
Here is small example with jqx Widgets 7let localData = [ { "rc 1": "0.12", "rc 2": "0.12", "rc 3": "0.12", "rc 4": "0.12", "rc 5": "0.12", "rc 6": "0.12", "rc 7": ".12", "uid": 0, "gid": "dr", "desc": "The real discount rate is the interest rate used in discounted cash flow analysis to determine the present value of future cash flows without inflation.", "item": "Real discount rate (r)", "unit": "1\/year", "var": "r", "type": "d3" }, { "rc 1": "600000", "rc 2": "666000", "rc 3": "380000", "rc 4": "600000", "rc 5": "600000", "rc 6": "600000", "rc 7": "1000000", "uid": 1, "gid": "ppd", "desc": "Net electric power (P) is the original design net capacity (electric power) which is the unit electric output after deducting the self-consumption power assumed by the original unit design. This value does not reflect possible power changes during subsequent operation.", "item": "Net electric power (P)", "unit": "kW(e)", "var": "NEP", "type": "n" }, { "rc 1": "4", "rc 2": "6", "rc 3": "3", "rc 4": "4", "rc 5": "4", "rc 6": "4", "rc 7": "5", "uid": 2, "gid": "ppd", "desc": "Construction time (T<sub>C<\/sub>) is the time period from the date when first investment into reactor construction project is made till the date of grid connection.", "item": "Construction time (T<sub>C<\/sub>)", "unit": "years", "var": "CT", "type": "n" }, { "rc 1": "60", "rc 2": "35", "rc 3": "40", "rc 4": "60", "rc 5": "60", "rc 6": "60", "rc 7": "60", "uid": 3, "gid": "ppd", "desc": "Lifetime of the plant (t<sub>LIFE<\/sub>) is time of plant commercial operation. For recently designed PWRs it is usually 60 years. For those of the designs, e.g. HWR with pressure tube replacement envisaged, where NPP life time can be extended by the replacement of this equipment one should take into account non-zero back fitting costs for extended lifetime.", "item": "Lifetime of the plant (t<sub>LIFE<\/sub>)", "unit": "years", "var": "LT", "type": "n" } ] var source = { localdata: localData, datatype: 'json', }; var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert('Error loading "' + source.url + '" : ' + error); } }); headerDetails = [ {name: "rc 1", type: "PWR"}, {name: "rc 2", type: "HWR"}, {name: "rc 3", type: "FPP"}, {name: "rc 4", type: "PWRmox"}, {name: "rc 5", type: "FR"}, {name: "rc 6", type: "FBR"}, {name: "rc 7", type: "NES"}]; var gridReactorColumns = []; var width = 125; var kolona1 = {text: '', datafield:'item', width: width, minwidth: '300', pinned: true, editable: false}; gridReactorColumns.push(kolona1); let kolone; $.each(headerDetails, function (id, object) { kolone = {text: object.name+" <sub class='danger'>"+object.type+"</sub>", datafield:object.name, width: width, align: 'right', cellsalign: 'right' }; gridReactorColumns.push(kolone); }); $('#jqxGrid').jqxGrid({ autoheight: true, width: '100%', altrows: true, source: dataAdapter, editable: true, columnsresize:true, columnsautoresize:true, columns: gridReactorColumns, }); $("#btnExport").on('click', function(e){ e.preventDefault(); $("#jqxGrid").jqxGrid('exportdata', 'xls', 'name'); });
Thanks.
Anything?
I think I set up widget OK but export is not working as it should.
Any ideas would be appreciated.
ThanksHello atomic,
You haven’t specified the type of the data field in your source’s
datafields
property.
Try setting it to ‘string’. You can see an Example here.Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.