Pagesize and raddomaindatasource

11 posts, 3 answers
  1. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 16 Jun 2012 Link to this post

    i have changed the template of the raddatapger to include a textbox that is bound to the pagesize property of its relative source like so

    <ControlTemplate x:Key="DataPagerPresenterTemplate" TargetType="Telerik_Windows_Controls_Data_DataPager:DataPagerPresenter">
        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
            <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="0" Margin="5,0" Orientation="Horizontal" Visibility="{Binding PagerControlsVisibility.TextControlVisibility, RelativeSource={RelativeSource TemplatedParent}}">
                    <TextBlock Text="Page Size: " VerticalAlignment="Center" />
                    <TextBox Text="{Binding PageSize,Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center" />
                    <Border Background="{StaticResource RadPager_Separator1}" HorizontalAlignment="Left" Height="18" Margin="5,0,0,0" VerticalAlignment="Center" Width="1"/>
                    <Border Background="{StaticResource RadPager_Separator2}" HorizontalAlignment="Left" Height="18" Margin="0,0,10,0" VerticalAlignment="Center" Width="1"/>
                </StackPanel>


    the datapager is bound to domain data source like so

    <telerik:RadDomainDataSource QueryName="GetVBinMaster_ALLStock_Ordered" x:Name="ddsStock" AutoLoad="True"  PageSize="250" >
        <telerik:RadDomainDataSource.DomainContext>
            <Stock:InventoryDomainContext x:Name="Inventory" />
        </telerik:RadDomainDataSource.DomainContext>
    </telerik:RadDomainDataSource>

    <telerik:RadDataPager  x:Name="StockDataPager" Grid.Column="0"
                           Source="{Binding DataView, ElementName=ddsStock}"
                           DisplayMode="All"
                           AutoEllipsisMode="Both"
                           NumericButtonCount="10"
                           IsTotalItemCountFixed="True" Style="{StaticResource RadDataPagerStyle1}" />


    there are 666 items in the database table.
    if i change the orignal value from 250 to 500 the domaindatasource load is not called

    i have included a couple of snapshots
    as you can see in my trace window the first 250 were retrieved (auto load) but after the change no load is done.

    i feel this is wrong the domaindatasource should be told to load the whole 500 if the size changed.
    in fact if the pagesize changes on the domaindata source itself this is the effect

    thanks
    dco
  2. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 20 Jun 2012 Link to this post

    Hi,

    The problem comes from the fact that you are using RadDomainDataSource for paging instead of RadDataPager control. Move setting PageSize="250" from RadDomainDataSource to RadDataPager and everything should work as expected.

    Greetings,
    Nedyalko Nikolov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 20 Jun 2012 Link to this post

    as you asked i moved the pagesize from the raddomainsource to the raddatapager but it still shows the same behavior

    that is if the pagesize is increased  the pager does not tell the domain source to reload

    <telerik:RadDomainDataSource QueryName="GetVBinMaster_ALLStock_Ordered" x:Name="ddsStock" AutoLoad="True"  >
        <telerik:RadDomainDataSource.DomainContext>
            <Stock:InventoryDomainContext x:Name="Inventory" />
        </telerik:RadDomainDataSource.DomainContext>
    </telerik:RadDomainDataSource>

    <telerik:RadDataPager  x:Name="StockDataPager" Grid.Column="0" PageSize="250"
                           Source="{Binding DataView, ElementName=ddsStock}"
                           DisplayMode="All"
                           AutoEllipsisMode="Both"
                           NumericButtonCount="10"
                           IsTotalItemCountFixed="True" />

    I know that the pager is recieving the change cause the count of pages is adjusted properly

    thanks
    dco
  5. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 25 Jun 2012 Link to this post

    Hi,

    We need some more time to investigate the issue. We'll update you via this forum thread.

    Regards,
    Nedyalko Nikolov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 26 Jun 2012 Link to this post

    Hello,

    I am afraid that this exact scenario is impossible when using RadDomainDataSource. You can easily achieve this scenario if you use its underlying collection called QueryableDomainServiceCollectionView<T> and bind the pager and the grid directly to it. In this way, you will be able to control its page size via the pager. There is no difference between using the control and the collection -- the control is simply a very thing lightweight wrapper over the collection. All the work is done by the collection anyways.

    I have attached a sample project that demonstrates this. I have placed two buttons that change the page size to simulate your altered data pager template.

    I hope this helps.

    Regards,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 26 Jun 2012 Link to this post

     thankyou ross for your solution

    thanks
    dco
  8. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 28 Jun 2012 Link to this post

    Hello,

    I have some good news. We have changed our source code, so now even if you use RadDomainDataSource, when you change the PageSize of the pager, RadDomainDataSource will understand this and act accordingly, i.e. update its PageSize as well and reload data from the server.

    This fix will become available with our Latest Internal Build coming out on Monday.

    Greetings,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 28 Jun 2012 Link to this post

    excellent

    thanks gentleman (ross and Nedyalko Nikolov)  for your assistance
    dco
  10. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 03 Jul 2012 Link to this post

    a minor issue (theoretically)

    maybe this should be a new thread
    but here it is anyways

    I changed my coded to use the QueryableDomainServiceCollectionView as sugggested previously by Ross.
    and I bind the "Isbusy" of the gridview  to the "IsBusy" of the QueryableDomainServiceCollectionView.

    <telerik:RadGridView x:Name="LocationListGrid" Grid.Row="1" AutoGenerateColumns="False" ShowGroupPanel="False" ShowColumnFooters="False" CanUserInsertRows="False"  IsReadOnly="True"
                         IsBusy="{Binding LocationsQueryViewModel.LocationsDataView.IsBusy,Source={StaticResource InocartCommon}}" ItemsSource="{Binding LocationsQueryViewModel.LocationsDataView,Source={StaticResource InocartCommon}}"
                         SelectionMode="Extended">
    Public ReadOnly Property LocationsDataView() As QueryableDomainServiceCollectionView(Of InocartRIAServicesLibrary.Web.Stock.vLocMasterFlags)
        Get
            If _LocationsDataView Is Nothing Then
                ' seperate domain context from everything else 
                Dim InventorydomainContext As New InocartRIAServicesLibrary.Web.Stock.InventoryDomainContext
                Dim query = InventorydomainContext.getStockLocationsQuery
                _LocationsDataView = New QueryableDomainServiceCollectionView(Of InocartRIAServicesLibrary.Web.Stock.vLocMasterFlags)(InventorydomainContext, query)
                _LocationsDataView.AutoLoad = True
            End If
            Return _LocationsDataView
        End Get
    End Property
    Protected _LocationsDataView As QueryableDomainServiceCollectionView(Of vLocMasterFlags)

    if i call the load of the QueryableDomainServiceCollectionView the grid busy indicator does become visible and a load is done
    if i move forward to a new page the grid busy indicator does become visible and a load is done

    but if i change the pagesize a load is done but the isbusy indicator does not become visible.

    not a big problem
    but if the page size is large it could cause some issues for some click happy user.

    thanks
    dco
  11. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 05 Jul 2012 Link to this post

    Hello,

    This only happens when you are at the first page. Anyway, I managed to fix this issue. It will be working properly in the next Latest Internal Build.

    Regards,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  12. David Ocasio
    David Ocasio avatar
    147 posts
    Member since:
    Nov 2009

    Posted 05 Jul 2012 Link to this post

    thanks very much ross
    i really do appreciate your assistance sir

    thanks
    dco


Back to Top
DevCraft banner