This is a migrated thread and some comments may be shown as answers.

RadDataPager issue selected page index...

12 Answers 291 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Karthik
Top achievements
Rank 1
Karthik asked on 27 May 2013, 01:56 AM
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

12 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 27 May 2013, 07:43 AM
Hi,

Maybe you should use the PageIndexChanging event which cancelable?

Regards,
Rossen Hristov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Karthik
Top achievements
Rank 1
answered on 28 May 2013, 01:35 PM
Yeah, I tried that but before I even hit cancel button the pageindexchanged event is firing...
0
Rossen Hristov
Telerik team
answered on 29 May 2013, 06:44 AM
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.

0
Tanna
Top achievements
Rank 1
answered on 01 Mar 2018, 07:11 AM

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

0
Yoan
Telerik team
answered on 05 Mar 2018, 04:38 PM
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.
0
Tanna
Top achievements
Rank 1
answered on 06 Mar 2018, 09:43 AM

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
0
Tanna
Top achievements
Rank 1
answered on 06 Mar 2018, 09:53 AM
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
0
Yoan
Telerik team
answered on 09 Mar 2018, 09:37 AM
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.
0
Tanna
Top achievements
Rank 1
answered on 12 Mar 2018, 12:36 PM

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.)

 

 

0
Yoan
Telerik team
answered on 15 Mar 2018, 12:25 PM
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.
0
Tanna
Top achievements
Rank 1
answered on 15 Mar 2018, 12:42 PM

Thank you Yoan.

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

0
Yoan
Telerik team
answered on 19 Mar 2018, 12:31 PM
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.
Tags
DataPager
Asked by
Karthik
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Karthik
Top achievements
Rank 1
Tanna
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or