This is a migrated thread and some comments may be shown as answers.

RadGrid with RadClientDataSource -t

6 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
TomaszRabiasz
Top achievements
Rank 1
TomaszRabiasz asked on 13 Sep 2017, 11:34 AM
 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test003.aspx.cs" Inherits="Test003" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="rsmMain"></telerik:RadScriptManager>
        <telerik:RadClientDataSource
            runat="server"
            ID="DS1"
            AllowPaging="true"
            EnableServerSorting="true"
            EnableServerFiltering="true"
            EnableServerPaging="true"
        >
        <DataSource>
            <WebServiceDataSourceSettings>
                <Select EnableCaching="false" Url="../api/test"  RequestType="Post" />
            </WebServiceDataSourceSettings>
        </DataSource>
        <Schema>
            <Model ID="Id">
                <telerik:ClientDataSourceModelField FieldName="Id" DataType="Number"  />
                <telerik:ClientDataSourceModelField FieldName="Name" DataType="String" />
                <telerik:ClientDataSourceModelField FieldName="Category" DataType="String" />
                <telerik:ClientDataSourceModelField FieldName="Price" DataType="Number" />
            </Model>
        </Schema>
        <ClientEvents
                OnRequestEnd="OnRequestEnd"
                OnDataParse="OnDataParse"
                OnCountRequested="OnCountRequested"
            />
    </telerik:RadClientDataSource>
    <br />
    <telerik:RadGrid runat="server" ID="rgMain"
         RenderMode="Lightweight"
         ClientDataSourceID="DS1"
         AllowMultiRowSelection ="true"
         AllowSorting="True"
         AllowPaging="True"
         PageSize="100"
         AutoGenerateColumns="false"
         AllowFilteringByColumn="true"
        >
        <MasterTableView AutoGenerateColumns="false" ClientDataKeyNames="Id" HierarchyLoadMode="Client">
            <Columns>
                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Id"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Category" HeaderText="Category" UniqueName="Category"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Price" HeaderText="Price" UniqueName="Price"></telerik:GridBoundColumn>
            </Columns>
            <PagerStyle AlwaysVisible="true" Mode="NextPrevNumericAndAdvanced" />
            <NestedViewTemplate>
                <asp:Literal runat="server" ID="Test">TEST</asp:Literal>
            </NestedViewTemplate>
        </MasterTableView>
        <ClientSettings>
            <ClientEvents OnCommand="OnGridCommand" OnGridCreated="OnGridCreated" OnDataBinding="OnDataBinding" OnDataBound="OnDataBound" />
        </ClientSettings>
    </telerik:RadGrid>
    <br />
    <telerik:RadCodeBlock runat="server" ID="rcbTest">
        <script type="text/javascript">
            var gcId = "";
            var countRg = 20;
            OnRequestEnd = function (sender, args) {
                console.log('OnRequestEnd');
                //console.log(sender);
                //console.log(args);
            }
            OnDataParse = function (sender, args) {
                console.log('OnDataParse');
                var response = args.get_response();
                countRg = response.count;
                if (response) {
                    args.set_parsedData(response.Data);
                }
            }
            OnCountRequested = function (sender, args) {
                args.set_countField(countRg);
                console.log('OnCountRequested');
            }
            OnGridCommand = function(sender, args) {
                if (args.get_commandName() == "Page")
                    console.log("Page Index Changed");
                else if (args.get_commandName() == "PageSize") {
                    args.set_cancel(true);
                    if (args.get_tableView().get_pageSize() > 50) {
                        args.get_tableView().set_pageSize(50)
                        console.log("Page Size Changed BIG");
                    }
                    console.log("Page Size Changed");
                }
                else {
                    console.log('COMMAND:' + args.get_commandName());
                }
                     
            }
            OnGridCreated = function (sender, args) {
                gcId = sender.get_id();
                console.log('Grid Created');
                var mtv = sender.get_masterTableView();
                mtv.set_pageSize(20);
            }
            OnDataBinding = function (sender, args) {
                console.log('OnDataBinding');
            }
            OnDataBound = function (sender, args) {
                console.log('OnDataBound');
            }
        </script>
    </telerik:RadCodeBlock>
    </form>
</body>
</html>

 

 

Is a part of my code.
When I filtring allways ask twice. 
On start asks triple time.
When I showing Comand Panel and clikd Refresh asking four times.

 

What i Do wrong, any sugestion.

 

 

6 Answers, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 18 Sep 2017, 01:40 PM
Hello Rafal,

Thank you for bringing this issue to our attention, which was logged as a bug. I've updated your Telerik points as a token of gratitute.


Regards,
Attila
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Stefania
Top achievements
Rank 2
answered on 29 Dec 2017, 11:03 AM

Hi,

any news?

I have the same issue with OnChange event

 

Thank you

0
Stefania
Top achievements
Rank 2
answered on 29 Dec 2017, 01:20 PM
I need to reload a map with the new points filtered on grid but the event OnChange it seems get fired multiple times and this variable

sender.get_filterExpressions()._hasFilerEntries

is true the first time and than change to false

JS

function LoadBigMap(sender, args) {
                if (sender.hasChanges()) {
                    var response;
                    if (sender.get_filterExpressions()._hasFilerEntries) {
                        if (sender.view().length == 0) {
                            response = sender.view();
                        }
                        else {
                            response = sender.view()[0].items;//sender.view();
                        }
                    }
                    else
                        response = sender.get_data();         
 
                    if (response) {                   
                        //parm:    POINTS, DIVNAME,ZOOM,MAPTYPE,SHOW CLUSTER
                        LoadHomeMap(response, "map", 2, "ROADMAP", true);                      
                    }                  
                }              
            }

 

XAML

<telerik:RadClientDataSource ID="RadClientDataSource1" runat="server" AllowBatchOperations="true">        
            <ClientEvents OnDataParse="OnParse" OnChange="LoadBigMap"  OnRequestStart="ShowLoading" OnRequestEnd="HideLoading" OnCustomParameter="ParameterMap" />
...
0
Attila Antal
Telerik team
answered on 17 Jan 2018, 09:42 AM
Hi Stefania,

This particular issue has not been fixed yet, but our developer team is working on it.

In the meantime, you could check out the following Code Library article that could be of help in your scenario: Retrieve filtered data from RadClientDataSource using RadGrid's event

Please give it a try to see if that works for you.

Kind Regards,
Attila Antal
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Stefania
Top achievements
Rank 2
answered on 30 Jan 2018, 11:07 AM

Hi, thanks for your reply.

Unfortunately that solution is not work for me.

Do you know when it will be fixed?

 

Thank you

0
Attila Antal
Telerik team
answered on 01 Feb 2018, 02:22 PM
Hi Stefania,

Fix for the reported problems are being developed in an order based on their priority,  customer demand, and therefore, the estimation for delivering a fix for this issue is not yet established. You can visit the item Grid with RadClientDataSource sends two requests when navigating with Grid pager in our Feedback Portal, click Like to raise its priority as well subscribe to follow the upcoming news about it.

Nevertheless, I would kindly suggest you to isolate the issue in a sample project and send it to us in a formal support ticket. Our support team will investigate the scenario and assist you with that. In addition to the sample, would be helpful if you could describe the steps you would like to achieve. You can use to modify the following Code Library sample (Retrieve filtered data from RadClientDataSource using RadGrid's event) which has a dummy data and will help you save some effort.

Kind regards,
Attila Antal
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
TomaszRabiasz
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Stefania
Top achievements
Rank 2
Share this question
or