RadDataPager issue selected page index...

13 posts, 0 answers
  1. Karthik
    Karthik avatar
    10 posts
    Member since:
    Jul 2012

    Posted 26 May 2013 Link to this post

    Hello 
    I am using telerik rad controls for developing a silverlight 4 application. I am working on some thing like this, when a user edits a cell in radgridview and try to go to next page without saving the edited item (fig pagerintial.png), I am poping up a  warning msg saying that, "Ok"  buttonto cancel edited items and go to next page or "Cancel" button to stay on the current page(fig pagerwarningmsg.png).

    I have a problem when hitting "Cancel" button, I am staying on the current page which is fine, but the raddatapager is displaying the new page index(fig pagererror.png).can anyone help me out with this issue, please refer the images and code below.

    <telerik:RadDataPager x:Name="OrderPager"
                                            Grid.Row="2"
                                            Grid.Column="0"
                                            Source="{Binding PagedCollectionView, Source={StaticResource PFOViewModel}}"
                                            IsTotalItemCountFixed="False"
                                            DisplayMode="FirstLastPreviousNextNumeric, Text"
                                            telerik:StyleManager.Theme="Summer"
                                            PageIndexChanging="OrderPager_PageIndexChanging" PageSize="{Binding PageSize}" 
                                            PageIndexChanged="OrderPager_PageIndexChanged" 
                                            NumericButtonCount="10" />
     
    private void OrderPager_PageIndexChanging(object sender, Telerik.Windows.Controls.PageIndexChangingEventArgs e)
          {
              // We set this to true, that way the load method knows to keep our selections.
              // If this wasn't set then we would think it is a new set of filters so we should clear the selections
              pfoViewModel.IsPaging = true;
          }

     
    private void OrderPager_PageIndexChanged(object sender, PageIndexChangedEventArgs e)
            {
                if (IsDirty == true && addedItems != null)
                {
                    TextBlock tb = new TextBlock();
                    tb.TextWrapping = TextWrapping.Wrap;
                    tb.Height = 100;
                    tb.Width = 250;
                    tb.Text = ApplicationStrings.SaveDatatMsg;
                    tb.FontSize = 12;
                    tb.FontFamily = new System.Windows.Media.FontFamily("Verdana");
     
                    //Pop Up Dialog
                    Telerik.Windows.Controls.DialogParameters parameters = new Telerik.Windows.Controls.DialogParameters();
                    parameters.Header = ApplicationStrings.SaveDataWarningCaption;
                    parameters.Content = tb;
                    parameters.Theme = new Telerik.Windows.Controls.SummerTheme();
                    parameters.OkButtonContent = ApplicationStrings.OKButton;
                    parameters.CancelButtonContent = ApplicationStrings.CancelButton;
     
                    parameters.Closed = (sender1, e1) =>
                    {
                        IsDirty = false;
                        if (e1.DialogResult != null && e1.DialogResult.Value == true)
                        {
                            pfoViewModel.RejectChanges();
                            grdProducts.CancelEdit();
                            addedItems.Clear();
                            //Perform the Paging Operation
                            pfoViewModel.Page = e.NewPageIndex;
                        }
                        else
                        {
                            pfoViewModel.IsPaging = false;
                            pfoViewModel.Page = e.OldPageIndex;
                        }
                    };
     
                    Telerik.Windows.Controls.RadWindow.Confirm(parameters);
                }
                else
                {
                // Change the data to the next page of data...
                pfoViewModel.Page = e.NewPageIndex;
                // pfoViewModel.IsPaging = false;
                }
            }
      
     public int Page
            {
                get { return pageCurrent; }
                set
                {
                    if (pageCurrent == value)
                        return;
     
                    pageCurrent = value;
                    RaisePropertyChanged("Page");
                    // Re-load...
                    RefreshRecords();
                }
            }
            private int pageCurrent = 0;  // Default
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 27 May 2013 Link to this post

    Hi,

    Maybe you should use the PageIndexChanging event which cancelable?

    Regards,
    Rossen Hristov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Karthik
    Karthik avatar
    10 posts
    Member since:
    Jul 2012

    Posted 28 May 2013 Link to this post

    Yeah, I tried that but before I even hit cancel button the pageindexchanged event is firing...
  4. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 29 May 2013 Link to this post

    Hello,

    That is really strange and unexpected. Can you please open a new support ticket from your licensed Telerik account and send us a dummy project that demonstrates this behavior. We will take a look. Thanks in advance.

    Regards,
    Rossen Hristov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Tanna
    Tanna avatar
    5 posts
    Member since:
    Nov 2012

    Posted 01 Mar in reply to Rossen Hristov Link to this post

    Hi,

    We are facing the same issue recently. Can you update me, whether this is resolved or not, and provide the reference to the support ticket if exists. Otherwise I can file one.

    Thanks,

    Rahul

  6. Yoan
    Admin
    Yoan avatar
    1149 posts

    Posted 05 Mar Link to this post

    Hello Rahul,

    Actually, there is no other support ticket from the other client. So, it is unclear what is the exact problem. May I ask you to share more information about the issue that you are experiencing?

    Regards,
    Yoan
    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.
  7. Tanna
    Tanna avatar
    5 posts
    Member since:
    Nov 2012

    Posted 06 Mar in reply to Yoan Link to this post

    I am facing the same problem that Karthik mentioned above.
    I have used RadDataPager and binded the source to "Items" property of RadGridView.

    <telerik:RadGridView ItemsSource="{Binding ListItems}" x:Name="listView" Height="200"/><br><br>        <telerik:RadDataPager Source="{Binding Items, ElementName=listView}" Margin="10" AutoEllipsisMode="Both"<br>                              PageSize ="2" DisplayMode="All" Height="Auto"<br>                              PageIndex="{Binding PageIndex,Mode=TwoWay}" IsTotalItemCountFixed="True"><br><br>            <telerik:EventToCommandBehavior.EventBindings><br><br>                <telerik:EventBinding EventName="PageIndexChanging"  <br>                         Command="{Binding Path=PageIndexChangingCommand, UpdateSourceTrigger=PropertyChanged}"<br> PassEventArgsToCommand="True" RaiseOnHandledEvents="True" /><br><br>            </telerik:EventToCommandBehavior.EventBindings>


    Whenever user tries to go to next page from the current one, I would like to check if there is any unsaved data in the current page. If there is any unsaved data, I will popup a message box with the options Save/Don't Save/Cancel.
    If user clicks on Save/Don't Save, modifications in the page 1 will be saved/discarded respectively and then go to next page. This is working fine
    If user clicks on Cancel, I should stay in the current page and data pager should highlight the current page. The first part is working fine. I.e. I am staying the current page. However, the later part is not working. Next page number is highlighting, not the current page number.
    Below is the execute method of PageIndexChangingCommand.

    Private Sub OnExecutePageIndexChangingCommand(obj As Object)<br><br>        Dim handler As PageIndexChangingEventArgs = DirectCast(obj, PageIndexChangingEventArgs)<br><br>        Dim result As MsgBoxResult = MsgBox("Traverse?",
    MsgBoxStyle.OkCancel)<br><br>        If result = MsgBoxResult.Ok Then<br>        Else<br>            handler.Cancel = True<br>        End If<br><br>End Sub
  8. Tanna
    Tanna avatar
    5 posts
    Member since:
    Nov 2012

    Posted 06 Mar in reply to Tanna Link to this post

    Messed up with formatting. Below are the code pieces in above message.

    <telerik:RadGridView ItemsSource="{Binding ListItems}" x:Name="listView" Height="200"/>

            <telerik:RadDataPager Source="{Binding Items, ElementName=listView}" Margin="10" AutoEllipsisMode="Both"
                                  PageSize ="2" DisplayMode="All" Height="Auto"
                                  PageIndex="{Binding PageIndex,Mode=TwoWay}" IsTotalItemCountFixed="True">

                <telerik:EventToCommandBehavior.EventBindings>

                    <telerik:EventBinding EventName="PageIndexChanging" 
                             Command="{Binding Path=PageIndexChangingCommand, UpdateSourceTrigger=PropertyChanged}"
     PassEventArgsToCommand="True" RaiseOnHandledEvents="True" />

                </telerik:EventToCommandBehavior.EventBindings>

    Private Sub OnExecutePageIndexChangingCommand(obj As Object)

            Dim handler As PageIndexChangingEventArgs = DirectCast(obj, PageIndexChangingEventArgs)

            Dim result As MsgBoxResult = MsgBox("Traverse?", MsgBoxStyle.OkCancel)

            If result = MsgBoxResult.Ok Then
            Else
                handler.Cancel = True
            End If

    End Sub
  9. Yoan
    Admin
    Yoan avatar
    1149 posts

    Posted 09 Mar Link to this post

    Hello,

    I've tried to reproduce the problem you report but to no avail. I've created a sample project based on the provided code snippets. Please give it a try and let me know how it works on your side. May I ask you to confirm the version of Telerik UI for Silverlight that you are using?

    Regards,
    Yoan
    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.
  10. Tanna
    Tanna avatar
    5 posts
    Member since:
    Nov 2012

    Posted 12 Mar in reply to Yoan Link to this post

    Mine is Telerik WPF application and version is 2018.1.220.45. I have used the code that you sent to me in my example application and I am still getting the issue.

    I have attached the complete project. (As the .zip extension is not allowing, I have changed the file extension to JPG. Please modify the extension to .zip once you have downloaded.)

     

     

  11. Yoan
    Admin
    Yoan avatar
    1149 posts

    Posted 15 Mar Link to this post

    Hello Tanna,

    Thank you for providing the sample project.

    I am able to reproduce the issue if I am using the numeric buttons for switching the pages. If you use the Next button the issue is not reproducible.

    I have logged this in our bug tracking system. You can subscribe to the following public item in order to get notifications regarding the status of the issue:
    NumericButton stays checked after canceling the PageIndexChanging event.

    Regards,
    Yoan
    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.
  12. Tanna
    Tanna avatar
    5 posts
    Member since:
    Nov 2012

    Posted 15 Mar in reply to Yoan Link to this post

    Thank you Yoan.

    Can you please let me know, if there is any workaround to achieve this?

  13. Yoan
    Admin
    Yoan avatar
    1149 posts

    Posted 19 Mar Link to this post

    Hello,

    Actually, I have fixed the issue. The fix will be available in our upcoming internal build which is scheduled for next Monday.

    Regards,
    Yoan
    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