RadGrid with RadClientDataSource -t

7 posts, 0 answers
  1. TomaszRabiasz
    TomaszRabiasz avatar
    14 posts
    Member since:
    Oct 2009

    Posted 13 Sep 2017 Link to this post

     
    <%@ 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.

     

     

  2. Attila Antal
    Admin
    Attila Antal avatar
    87 posts

    Posted 18 Sep 2017 Link to this post

    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.
  3. Stefania
    Stefania avatar
    150 posts
    Member since:
    May 2013

    Posted 29 Dec 2017 in reply to Attila Antal Link to this post

    Hi,

    any news?

    I have the same issue with OnChange event

     

    Thank you

  4. Stefania
    Stefania avatar
    150 posts
    Member since:
    May 2013

    Posted 29 Dec 2017 in reply to Stefania Link to this post

    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" />
    ...
  5. Attila Antal
    Admin
    Attila Antal avatar
    87 posts

    Posted 17 Jan Link to this post

    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.
  6. Stefania
    Stefania avatar
    150 posts
    Member since:
    May 2013

    Posted 30 Jan in reply to Attila Antal Link to this post

    Hi, thanks for your reply.

    Unfortunately that solution is not work for me.

    Do you know when it will be fixed?

     

    Thank you

  7. Attila Antal
    Admin
    Attila Antal avatar
    87 posts

    Posted 01 Feb Link to this post

    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.
Back to Top