Gridview DataPager QueryableDomainServiceCollectionView

8 posts, 0 answers
  1. poet_byron
    poet_byron avatar
    21 posts
    Member since:
    Mar 2010

    Posted 01 Feb 2011 Link to this post

    I have a QueryableDomainServiceCollectionView in my ViewModel:

    private QueryableDomainServiceCollectionView<HR.CurrentAssociateSelected> _currentAssociateSelectedQDSCV;
    public QueryableDomainServiceCollectionView<HR.CurrentAssociateSelected> currentAssociateSelectedQDSCV
    {
      get { return _currentAssociateSelectedQDSCV; }
      set
      {
        if (currentAssociateSelectedQDSCV == value)
          return;
        _currentAssociateSelectedQDSCV = value;
        OnPropertyChanged("currentAssociateSelectedQDSCV");
      }
    }

    This is set up in the constructor:

    EntityQuery<HR.CurrentAssociateSelected> getCurrentAssociateSelected = ctx2.GetCurrentAssociateSelectedIncludeUserQuery(null, null, 1).OrderBy(p => p.currentAssociate.currentAssociate.firstName).OrderBy(p => p.currentAssociate.currentAssociate.lastName);
    currentAssociateSelectedQDSCV = new QueryableDomainServiceCollectionView<HR.CurrentAssociateSelected>(ctx2, getCurrentAssociateSelected);
    currentAssociateSelectedQDSCV.PageSize = 20;
    currentAssociateSelectedQDSCV.AutoLoad = true;

    And is bound to a radGridView and radDataPager:

    <telerik:RadGridView AutoGenerateColumns="False" Height="300" ItemsSource="{Binding currentAssociateSelectedQDSCV, Mode=TwoWay}" Name="editUserSubscrDataGrid" SelectionMode="Single">
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn x:Name="editUserLoginNameColumn" DataMemberBinding="{Binding Path=currentAssociate.currentUser.loginName}" Header="Login Name" ShowDistinctFilters="False" IsReadOnly="True" />
            <telerik:GridViewDataColumn x:Name="editUserLastNameColumn" DataMemberBinding="{Binding Path=currentAssociate.currentAssociate.lastName}" Header="Last Name" IsReadOnly="True" />
            <telerik:GridViewDataColumn x:Name="editUserFirstNameColumn" DataMemberBinding="{Binding Path=currentAssociate.currentAssociate.firstName}" Header="First Name" IsReadOnly="True" />
            <telerik:GridViewDataColumn x:Name="editUserTitleColumn" DataMemberBinding="{Binding Path=currentAssociate.currentAssociateExtendedData.title}" Header="Title" IsReadOnly="True" />
            <telerik:GridViewDataColumn x:Name="editUserHomeStoreCodeColumn" DataMemberBinding="{Binding Path=currentAssociate.homeStore.code}" Header="Store CD" IsReadOnly="True" />
            <telerik:GridViewDataColumn x:Name="editUserHomeStoreNameColumn" DataMemberBinding="{Binding Path=currentAssociate.homeStore.name}" Header="Store Name" IsReadOnly="True" />
            <telerik:GridViewCheckBoxColumn x:Name="editUserSelected" DataMemberBinding="{Binding Path=isSelected, Mode=TwoWay}" AutoSelectOnEdit="True" EditTriggers="CellClick">
                <telerik:GridViewCheckBoxColumn.Header>
                    <Grid>
                        <CheckBox x:Name="editUserSelectAllChk" Content="Select All" Foreground="White" Click="editUserSelectAllChk_Click" />
                    </Grid>
                </telerik:GridViewCheckBoxColumn.Header>
            </telerik:GridViewCheckBoxColumn>
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>
    <telerik:RadDataPager x:Name="editUserSubscrDataPager" DisplayMode="All" Source="{Binding currentAssociateSelectedQDSCV, Mode=TwoWay}" IsTotalItemCountFixed="True" PageSize="20" />

    When I check the checkbox in the gridview, the data pager gets enable and never gets re-enabled.  Why does this happen?  Does it matter that the update statement in the WCF RIA Service doesn't actually do anything?  I only intend on working with this on the client side.
  2. poet_byron
    poet_byron avatar
    21 posts
    Member since:
    Mar 2010

    Posted 01 Feb 2011 Link to this post

    For an example, I edited the MVVMTelerikDomainServices sample and removed the IsReadOnly=True from the datagrid and started trying to edit stuff within the grid.  After editing something, the datapager becomes disabled.
  3. DevCraft banner
  4. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 02 Feb 2011 Link to this post

    Hi Matthew Carr,

    Unfortunately we are unable to replicate the problem. Could you please open a separate support ticket and attach a runnable sample project along with the exact steps we need to take in order to replicate this issue.

    Thanks in advance.

    P.S. If you replace RadDataPager with the MS DataPager is the behavior any different?

    Kind regards,
    Ross
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  5. poet_byron
    poet_byron avatar
    21 posts
    Member since:
    Mar 2010
  6. Cody
    Cody avatar
    9 posts
    Member since:
    Mar 2011

    Posted 14 Apr 2011 Link to this post

    Cannot view the ticket... :)  I am interested in the reason though.
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 15 Apr 2011 Link to this post

    Hi Cody,

     I'm reposting the answer here:



    Hi Matthew,

    I think there might be a way to achieve this. The pager has the so-called Unbound Mode. When inUnbound Mode, you use the pager solely to take advantage of its UI. It has no Source defined hence the term Unbound Mode.

    When the pager is in Unbound Mode it is your responsibility to page the thing that needs paging. This is done by attaching to the PageIndexChanged event. When PageIndexChanged occurs you can read the index of the new page that is being requested by the user. Once you know this number you should call QueryableDomainServiceCollectionView.RejectChanges to cancel all pending changes. If you don't reject the changes you will most probably get an exception when you try to change the page and that is by design.

    Once you have called RejectChanges, you can call the QueryableDomainServiceCollectionView.MoveToPage(xxx) method to move the collection view to the desired page (it implements IPagedCollectionView among others).

    I am however unsure why you want to edit something on the client and not submit it on the server, but that is up to you.

    Let me know if there are problems with this approach.

    All the best,
    Ross 
    the Telerik team



    Kind regards,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Cody
    Cody avatar
    9 posts
    Member since:
    Mar 2011

    Posted 15 Apr 2011 Link to this post

    Thank you.
  9. poet_byron
    poet_byron avatar
    21 posts
    Member since:
    Mar 2010

    Posted 15 Apr 2011 Link to this post

    A reason this may need to be accomplished is, say I have a model on the client side that I map what's returned from the service to.  Then I bind these fields to the gridview.  It seems like the only time you would ever want to disable paging is when items are added / removed, which would cause a paging issue.  Even then, if you return the count of the full query with the QDSCV, it would be easy to determine whether to add / remove a page, since you already know the page size.

    Pages = total % pagesize > 0 ? (int)(((double)total / (double)pagesize) + 1) : total / page size;

    Since silverlight is not synchronous, you may decide to do a bunch of stuff on the client.  Add stuff, remove it, modify it.  Then when you are satisfied with all your changes, you may want to submit them or reject them all.  It seems like this is a limitation.
Back to Top
DevCraft banner