Skip to content

DataPager in markup control #2001

Open
Open

Description

@tomasherceg

I created a repro in the branch bug/datapager-in-control for the issue reported on the forum.

DataPager determines the capabilities of the dataset by checking whether the data context implements IPageableGridViewDataSet<IPagingFirstPageCapability> and other *Capability interfaces, and renders the UI based on those capabilities.

The problem is that the DataContextStack in the control has type IPageableGridViewDataSet<IPagingOptions> from the viewmodel directive, but this type doesn't implement those capabilities. Therefore, the condition evaluates to false.

@exyi Is there a way around this? I tried to set the viewmodel to IPageableGridViewDataSet<PagingOptions>, but it throws an invalid cast error.

Activity

  1. exyi commented on Feb 25, 2026

    @exyi
    Member

    It is expected behavior, if you give DataPager binding of type IPageableGridViewDataSet<IPagingOptions>, it will not render anything. I think there should be some warning, as it's obviously unintended, but I don't think we have a reliable way to "fix it".

    I tried to set the viewmodel to IPageableGridViewDataSet, but it throws an invalid cast error.

    I think this should work (if the viewmodel actually is IPageableGridViewDataSet<PagingOptions>), I'll have a look why is it crashing

  2. exyi commented on Feb 25, 2026

    @exyi
    Member

    Ok I see that are two problems:

    1. The pager crashes when supplied with binding returning IPageableGridViewDataSet<PagingOptions>. This is clearly a bug and I fixed it your branch
    2. The dataset is not refreshed, because it does not implement IRefreshableGridViewDataSet. I'm not sure what to do with this one. Options are
      • Nothing, it's intended behavior. Not great
      • We can call RequestRefresh based on the dynamic type instead of the static return type. In this case it's possible, because it's a command and we always have the instance. However, I don't like that the behavior will be different for static commands (where this method has to be translated to JS), and it's not consistent most other decision being made on the static type
      • Move RequestRefresh() method to IBaseGridViewDataSet and only keep IRefreshableGridViewDataSet for the IsRefreshRequired property. Rationale is that the RequestRefresh does not add any real constaints on the base dataset, since it may be implemented as empty method without any state (I'd consider having this as default implementation on supported platforms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions