This is a migrated thread and some comments may be shown as answers.
Problem Export Excel
8 Answers 26 Views
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 02 Aug 2018, 10:43 AM
$("#grid").kendoGrid({ toolbar: ["excel"], excel: { fileName: "Kendo UI Grid Export.xlsx", proxyURL: "https://demos.telerik.com/kendo-ui/service/export", filterable: true}, dataSource: { type: "odata", transport: { read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Products"}, schema:{ model: { fields: {UnitsInStock: { type: "number" },ProductName: { type: "string" },UnitPrice: { type: "number" },UnitsOnOrder: { type: "number" },UnitsInStock: { type: "number" }}}}, pageSize: 7, group: { field: "UnitsInStock", aggregates: [{ field: "ProductName", aggregate: "count" },{ field: "UnitPrice", aggregate: "sum"},{ field: "UnitsOnOrder", aggregate: "average" },{ field: "UnitsInStock", aggregate: "count" }]}, aggregate: [{ field: "ProductName", aggregate: "count" },{ field: "UnitPrice", aggregate: "sum" },{ field: "UnitsOnOrder", aggregate: "average" },{ field: "UnitsInStock", aggregate: "min" },{ field: "UnitsInStock", aggregate: "max" }]}, sortable: true, pageable: true, groupable: true, filterable: true, columnMenu: true, reorderable: true, resizable: true, columns: [{ field: "ProductName", title: "Product Name", aggregates: ["count"], footerTemplate: "Total Count: #=count#", groupFooterTemplate: "Count: #=count#" },{ field: "UnitPrice", title: "Unit Price", aggregates: ["sum"] },{ field: "UnitsOnOrder", title: "Units On Order", aggregates: ["average"], footerTemplate: "Average: #=average#", groupFooterTemplate: "Average: #=average#" },{ field: "UnitsInStock", title: "Units In Stock", aggregates: ["min", "max", "count"], footerTemplate: "Min: #= min # Max: #= max #", groupHeaderTemplate: "Units In Stock: #= value # (Count: #= count#)" }]});

function search() {
            $('#grid').data('kendoGrid').dataSource.read({
                "CusCode": $("#CusCode").val(), "FromDate": $("#FromDate").val(), "ToDate": $("#ToDate").val()
                                    , "IsAllEquity": $("[name=rbStock]:checked").val(), "EquitySymbol": $("#EquitySymbol").val()
                                    , "IsAllDerivative": $("[name=rbDerivative]:checked").val(), "Instrument": $("#Instrument").val()
            });
            $("#grid").data("kendoGrid").refresh();
        }

 

Export Excel But data was lost when I called search() ( Use initialize parameter not in search() )

 

8 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 06 Aug 2018, 05:25 AM
Hello,

If you want to filter the data before exporting to Excel, you could use the "filter" method of the DataSource instead:
Additionally, you could see if the service return the data and populates the Grid correctly when you are passing additional data to the "read" function. Note that if you are using DatePicker widgets you will have to use their "value" method to get the selected Date object:
Hope this helps.


Regards,
Konstantin Dikov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
n/a
Top achievements
Rank 1
answered on 14 Aug 2018, 08:19 AM

Dear Konstantin Dikov,

I want retrieve from server but the fitter can use from the client. It doesn't refresh my data. 

Thank you.

0
n/a
Top achievements
Rank 1
answered on 14 Aug 2018, 09:09 AM

I can send the fitter to server already but can't use same as data.

data: 

"SymbolID": "", "MktID": "", "CustCode": $("#CustomerCode").val(), "Userlevel": "", "Userleveldef": "", "QType": ""

fitter:

 "SymbolID": "", "MktID": "", "CustCode": $("#CustomerCode").val(), "Userlevel": "", "Userleveldef": "", "QType": "" , fitter: [Object Object]

0
Angel Petrov
Telerik team
answered on 15 Aug 2018, 02:29 PM
Hi,

I am experiencing difficulties understanding the problem on hand. Can you please share with us the latest code and explain in detail the requirements? That would greatly facilitate us in assisting you further.

Regards,
Angel Petrov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
n/a
Top achievements
Rank 1
answered on 16 Aug 2018, 03:06 AM

Can I use the first topic post to export excel because I can't use like this you answer?

function search() {
            $('#grid').data('kendoGrid').dataSource.read({
                "CusCode": $("#CusCode").val(), "FromDate": $("#FromDate").val(), "ToDate": $("#ToDate").val()
                                    , "IsAllEquity": $("[name=rbStock]:checked").val(), "EquitySymbol": $("#EquitySymbol").val()
                                    , "IsAllDerivative": $("[name=rbDerivative]:checked").val(), "Instrument": $("#Instrument").val()
            });
            $("#grid").data("kendoGrid").refresh();
        }

0
Angel Petrov
Telerik team
answered on 17 Aug 2018, 01:19 PM
Hello,

I am still experiencing difficulties understanding the problem. Can you please elaborate in detail on what happens when the grid data is exported? What is the exact requirement?

Regards,
Angel Petrov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
n/a
Top achievements
Rank 1
answered on 20 Aug 2018, 04:22 AM

When call the searchCus()  I can't export excel.

Can you have export excel by document get by ID (DOM) grid ?

 

  $("#grid").kendoGrid({
                dataSource: {
                    type: "odata",
                    transport: {
                        read: {
                            // the remote service url
                            url: "wsCRM.asmx/crm_selIPOTrans", // GetBBGToADVTransactionsData is our web method

                            contentType: "application/json; charset=UTF-8",

                            type: "POST",

                            // JSONP is required for cross-domain AJAX
                            dataType: "json",

                            // additional parameters sent to the remote service
                            data:  /*"{Field:'',Text:'',page:1,rows:50000}"*/
                                { "SymbolID": "", "MktID": "", "CustCode": $("#CustomerCode").val(), "Userlevel": "", "Userleveldef": "", "QType": "" }
                        }
                    }, group: [
                        // group by "category" and then by "subcategory"
                        /*{
                            field: "GrpMkt"
                        },
                        { field: "GrpCust" },*/
                    ],
                    groupable: true,
                    serverPaging: true,
                    serverFiltering: true,
                    pageSize: 50,
                    schema: {
                        data: function (response) {
                            var data = JSON.parse(response.d);
                            return data["rows"];
                        },
                        total: function (response) {
                            var data = JSON.parse(response.d);
                            return data["total"];
                        }
                    }
                },
                toolbar: ["excel", "pdf"],
                excel: {
                    fileName: "Kendo UI Grid Export.xlsx",
                    proxyURL: "https://demos.telerik.com/kendo-ui/service/export",
                    filterable: true
                },
                pdf: {
                    allPages: true,
                    avoidLinks: true,
                    paperSize: "A4",
                    margin: { top: "2cm", left: "1cm", right: "1cm", bottom: "1cm" },
                    landscape: true,
                    repeatHeaders: true,
                    template: $("#page-template").html(),
                    scale: 0.8
                },
                height: 550,
                groupable: true,
                sortable: true,
                reorderable: true,
                resizable: false,
                pageable: {
                    refresh: true,
                    //pageSizes: true,
                    buttonCount: 5,
                    pageSizes: [10, 20, 30, 40, 50]
                },
                columns: [{
                   // template: "#:dateSqlTodate(data.FormatResDate)#",
                    field: "FormatResDate",
                    title: "SubscriptionDate",
                    width: 100
                }, {
                    field: "Symbol",
                    title: "Symbol",
                    //attributes: { style: "text-align:center;" },
                    width: 100
                }, {
                    field: "QuotaName",
                    title: "Allocated by",
                    width: 240
                }, {
                    field: "ConfirmUnit",
                    title: "Share",
                    format: "{0:n0}",
                    attributes: { style: "text-align:right;" },
                    width: 100
                }, {
                    field: "Price",
                    title: "IPO price",
                    format: "{0:n2}",
                    attributes: { style: "text-align:right;" },
                    width: 100
                }, {
                    field: "ConfirmAmt",
                    title: "Net Amount(THB)",
                    format: "{0:n2}",
                    attributes: { style: "text-align:right;" },
                    width: 150
                }]
            });
            $("#FromDate,#ToDate").kendoDatePicker();

        });

   function searchCus() {
            //$('#grid').data('kendoGrid').dataSource.read({ "SymbolID": "", "MktID": "", "CustCode": $("#CustomerCode").val(), "Userlevel": "", "Userleveldef": "", "QType": "" });

}

 

 

 

0
n/a
Top achievements
Rank 1
answered on 21 Aug 2018, 09:44 AM
I have solved my problem finish.
Tags
Grid
Asked by
n/a
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
n/a
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or