RadGrid with RadClientDataSource -t

2 posts, 0 answers
  1. Rafal Tynski
    Rafal Tynski avatar
    14 posts
    Member since:
    Oct 2009

    Posted 13 Sep 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
    5 posts

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