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

Single tap to edit cell.

12 Answers 181 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
Ole
Top achievements
Rank 1
Ole asked on 08 Oct 2018, 04:47 PM

Hi,

Is there a way to make a cell in telerikGrid:DataGridNumericalColumn or a customcolumn go into editmode via a single tap. 

 

12 Answers, 1 is accepted

Sort by
1
Didi
Telerik team
answered on 09 Oct 2018, 09:02 AM
Hi Ole,

You can achieve the described scenario with adding a command that responds on the DataGrid CellTap command and tell the datagrid that you want it to go in edit mode for this cell. I have attached an example how this could be achieved for TextColumn and NumericalColumn.

Please take a look at the attached project and let me know if you have any other questions.

Regards,
Didi
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Ole
Top achievements
Rank 1
answered on 09 Oct 2018, 09:52 AM
Than you very much, works like a charm.
0
Ole
Top achievements
Rank 1
answered on 09 Oct 2018, 11:20 AM

I was a bit to early out.

I also have ValidateCommand on the same Grid. After the Celltap was introduces

namespace TelerikXamarinApp1.Portable.Commands
{
    public class ValidateEditUserCommand : DataGridCommand
    {
        public ValidateEditUserCommand()
        {
            Id = DataGridCommandId.ValidateCell;
        }
 
 
        public override bool CanExecute(object parameter)
        {
            return true;
        }
 
        public override void Execute(object parameter)
        {
            ValidateCellContext validateContext = (ValidateCellContext)parameter;
            if (validateContext.Errors.Count==0)
            {
                FlightViewModel viewModel = (FlightViewModel) ((NavigationPage)
                Application.Current.MainPage).CurrentPage.BindingContext;
                viewModel.UpdateCalculation();
            }
            base.Execute(parameter);
 
        }
    }
}

 

dataGridFuel.Commands.Add(new ValidateEditUserCommand());
dataGridFuel.Commands.Add(new CellTapUserCommand(this.dataGridFuel));

 

Best regards

Ole

0
Didi
Telerik team
answered on 09 Oct 2018, 03:30 PM
Hi Ole,

Thank you for the provided code.

I have modified the attached sample and included the ValidationCommand on it. For the exact implementation of the validation command in RadDataGrid control please refer to the Country.cs file and ValidateCellCommand.cs file from the attached project.  

We're working on extending the DataGrid documentation with more information on the separate commands including the validation command.

I hope I could help.

Regards,
Didi
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Ole
Top achievements
Rank 1
answered on 15 Oct 2018, 01:11 PM

Hi,

The example did not trigger the validation. I used your project I just replaced you telerik nuget components with trial ones with same version. Could there be a difference in trial and non trial.

0
Didi
Telerik team
answered on 15 Oct 2018, 02:47 PM
Hi Ole,

I have tested the attached project with the trial version of Telerik UI for Xamarin controls and on my side the validation command is triggered as expected. Please take a look at the attached video. Regarding trial and non trial version of our suite I can confirm that there is no difference between the trial and licensed version of the controls, only a trial message pops up when referencing the trial nuget packages.

Let me know if you have any additional questions.

Regards,
Didi
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Ole
Top achievements
Rank 1
answered on 15 Oct 2018, 03:18 PM
ok I see your video, that it validates when navigating to a new line in the grid. I was hoping that it would be triggered also when moving between cells in  one row.  
0
Didi
Telerik team
answered on 16 Oct 2018, 02:02 PM
Hi Ole,

This is a standard validation mechanism using INotifyDataErrorInfo interface.  In the context of RadDataGrid, the validation is triggered when the cell is in edit mode and the end user tries to commit the entered value. It is not possible to exit the editing mode until the validation rule of the data item is met.

Could you elaborate more on what you mean with navigating between cells in one row? I am asking as in general this is not related to the editing functionality of the control.

Regards,
Didi
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Ole
Top achievements
Rank 1
answered on 06 Nov 2018, 09:39 AM

Scenario:

I edit a country name to more than 15 chars, then I click on the population column in the same row.

Then this happened:

HasErrors is true, the focus shifts to the populations field, no red warning bar.

I would have exspected:

HasError is true , focus still on name column , red warning bar displayed.

 

0
Didi
Telerik team
answered on 07 Nov 2018, 01:25 PM
Hello Ole,

I have tested the described scenario and on my side it works as expected. I have recorded a video, so you could take a look at it. Please note that this is a sample project that shows how the validation command could be implemented and you could customize it according to your specific setup.

May I ask you to modify the attached sample regarding your setup and send it back to me? In this case I could research it further. Also note that you should open a support ticket and attach the project there because in the forum only image attachments are allowed.

Regards,
Didi
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Ole
Top achievements
Rank 1
answered on 07 Nov 2018, 02:12 PM

I am using the demo project only.

I can see that you changed the project , country.cs line 27 . from > 15 to < 15.

Fixing that so hasErrors is false as a starting point for all rows.

Then start by editing Mozambique to have a length > 15, then imideately tap to edit the population column in the same row.

No other steps needed.

This scenario was not shown in the video.

Then this happened:
HasErrors is true, the focus shifts to the populations field, no red warning bar.
I would have exspected:
HasError is true , focus still on name column , red warning bar displayed.

I am using IOS.

Best Regards

Ole

0
Didi
Telerik team
answered on 09 Nov 2018, 11:48 AM
Hello Ole,

As the initial request was to change the default state of the CellTap command and execute BeginEdit command, this lead to changes in the default logic cycle how the DataGrid commands work. In order to achieve more complex scenario or changing the default command a custom logic should be implemented. So, I have modified the attached demo project to cover the expected scenario.  Please have in mind that this is a sample implementation you could use a starting point and further extend it if needed. Additionally, I cannot guarantee it covers all the use cases you might have.

I hope I was of  help.

Regards,
Didi
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
DataGrid
Asked by
Ole
Top achievements
Rank 1
Answers by
Didi
Telerik team
Ole
Top achievements
Rank 1
Share this question
or