We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid does not allow editing

Hello,

Despite I set AllowEditing=true, the 4 last columns are not editable.

Regards

Attachment: GridNotEditing_faa756fa.7z

8 Replies 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team July 17, 2020 06:49 AM UTC

Hi Brice, 
 
Thanks for contacting Syncfusion support.  
 
Query: “Despite I set AllowEditing=true, the 4 last columns are not editable. 
 
We have analyzed the provided sample and found that you are using Batch editing. So Column will go into edit state when double clicking the cell. But you have disabled the edit on double click using AllowEditOnDblClick property, so column will not go into edit mode unless edit actions is handled on single click. Refer our UG documentation to handle single click editing in batch editing.  
 
 
We have also found that you have not defined the IsPrimaryKey column. To perform edit action in Grid, IsPrimaryKey property must be specified to any one of the available who value is unique. So we have modified your column definition as below to define PrimaryKey Column in Grid and changed the model class with unique values.  
 
<SfGrid @ref="GridInstance" TValue="CollectiviteTypeOperation" DataSource="@typeOperations" 
            AllowSorting="true" AllowResizing=true EnableAltRow="true" Toolbar="@(new List<string>() { "Cancel""Update" })" 
            Width="100%" Height="100%"> 
        <GridEvents CellSelected="CellSelectHandler" TValue="CollectiviteTypeOperation"></GridEvents> 
        <GridEditSettings AllowEditing="true" Mode="EditMode.Batch" AllowEditOnDblClick="false"></GridEditSettings> 
        <GridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Both" Type="SelectionType.Single"></GridSelectionSettings> 
        <GridColumns> 
            <GridColumn Field="@nameof(CollectiviteTypeOperation.Nature)" AllowEditing="false" Width="100px"> 
                <Template> 
                    @if (((CollectiviteTypeOperation)context).Nature == "D") 
                    { 
                        <span>Dépenses</span> 
                    } 
                    else 
                    { 
                        <span>Recettes </span> 
                    } 
                </Template> 
            </GridColumn> 
            <GridColumn Field="@nameof(CollectiviteTypeOperation.Libelle)" AllowEditing="false" Width="100%"></GridColumn> 
            <GridColumn Field="@nameof(CollectiviteTypeOperation.IdCollectivite)" IsPrimaryKey="true" Visible="false" Width="100%"></GridColumn>
            <GridColumn Field="@nameof(CollectiviteTypeOperation.RevalorisationAutomatique)" AllowEditing="true" Width="105px" TextAlign="@TextAlign.Center" DisplayAsCheckBox="true"></GridColumn> 
            <GridColumn Field="@nameof(CollectiviteTypeOperation.PresenceTypeRevalorisation)" Width="150px" TextAlign="@TextAlign.Center" DisplayAsCheckBox="true"></GridColumn> 
            <GridColumn Field="@nameof(CollectiviteTypeOperation.PourcentageMaxDepassement)" Width="150px" TextAlign="@TextAlign.Right" EditType="@EditType.NumericEdit"></GridColumn> 
            <GridColumn Field="@nameof(CollectiviteTypeOperation.MontantMaxDepassement)" Width="150px" TextAlign="@TextAlign.Right" EditType="@EditType.NumericEdit"></GridColumn> 
        </GridColumns> 
    </SfGrid> 
 
public partial class CollectiviteTypeOperation   {       [Key]       public Guid IdCollectivite { getset; } = Guid.NewGuid();       public Guid IdTypeOperation { getset; }   }
 
.   
Either you can use IsPrimaryKey property of Grid Column, or DataAnnotations [Key] to define the Primarykey in Grid. Also if you do not want to display the primaryKey column in Grid, then use Visible property of Grid to hide particular column from Grid view.  
 
Please find the modified sample from below  
 
 
Refer our UG documentation for your reference 
 
 
Kindly get back to us if you have further queries.  
 
 
 
 
 
Regards, 
Vignesh Natarajan  



BF Brice FROMENTIN July 17, 2020 08:42 AM UTC

Thanks for your answer, I switch to Normal mode and still not editable :

[...]    GridEditSettings AllowEditing="true" Mode="EditMode.Normal" AllowEditOnDblClick="false" [...]
   
       
       
       
           
       
       
       
       
       
       
   

Regards


BF Brice FROMENTIN July 17, 2020 08:47 AM UTC

Thanks for your answer, I switch to Normal mode and still not editable :

[...]    GridEditSettings AllowEditing="true" Mode="EditMode.Normal" AllowEditOnDblClick="false" [...]
   
[...]    GridColumn Field="@nameof(CollectiviteTypeOperation.IdCollectivite)" Visible="false"
          GridColumn Field="@nameof(CollectiviteTypeOperation.IdTypeOperation)"  Visible="false"  [...]

Both are used to compose the primary key, how the grid handle this case ?

Regards


VN Vignesh Natarajan Syncfusion Team July 20, 2020 01:28 PM UTC

Hi Brice, 
 
Thanks for the update. 
 
Query: “Thanks for your answer, I switch to Normal mode and still not editable : 
 
We can perform Edit operation on Grid by double clicking the record or by selecting a record and clicking on Edit toolbar. But in your sample you have disabled the Edit operation using Double Click using AllowEditOnDblClick as false. Hence the record is not go into edit form. So if you do not want to prevent the double click edit action. Kindly remove the property (AllowEditOnDblClick) from GridEditSetttings.  
 
Refer the below code example.  
 
<SfGrid @ref="GridInstance" TValue="CollectiviteTypeOperation" DataSource="@typeOperations" 
           AllowSorting="true" AllowResizing=true EnableAltRow="true" Toolbar="@(new List<string>() { "Cancel""Update" })" 
           Width="100%" Height="100%"> 
       <GridEvents RowSelected="RowSelectHandler" TValue="CollectiviteTypeOperation"></GridEvents> 
       <GridEditSettings AllowEditing="true" Mode="EditMode.Normal"></GridEditSettings>         
       . . . ..  . 
   </SfGrid> 
 
 
If above solution does not resolve your query. Kindly share the more details about your requirement.  
 
  1. Do you want to perform edit operation on single click in Grid.
  2. Share the type of your EditMode (batchEditing, normal editing) you want to achieve in your sample.
 
Kindly share the above details to validate the reported query at our end provide solution as soon as possible.  
 
Query: “Both are used to compose the primary key, how the grid handle this case ? 
 
DataGrid can have multiple primary keys, CRUD operation in Grid will take place based on first primaryKey value. So kindly define the PrimaryKey column using IsPrimaryKey property or use Data Annotations [Key] attribute to define the primarykey to Grid.  
 
Kindly get back to us if you have further queries. 
 
Regards, 
Vignesh Natarajan  
  
 
 



BF Brice FROMENTIN July 21, 2020 08:22 AM UTC

Thanks for your answer, my main goal is to have single click edition mode like and excel sheet. I think it should be great if it was integrated in the grid without using the CellSelectHandler.


VN Vignesh Natarajan Syncfusion Team July 22, 2020 01:47 PM UTC

Hi Brice,  

Thanks for your update.  

Query: “ my main goal is to have single click edition mode like and excel sheet. I think it should be great if it was integrated in the grid without using the CellSelectHandler. 
 
We have analyzed your query and currently we do not have support for single click editing without using events and method. We have considered your requirement “single click edition mode in the grid without using the CellSelectHandler” as feature and added to our feature table. Thank you for requesting this feature and helping us define it.  

We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts. We have added this feature “Provide single click edit support” request to our database. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. It will be implemented in any of our upcoming releases.  
 
You can now track the current status of this feature request here. You can also communicate with us regarding the open features any time using our Feature Report page. 
 
 
Till then we suggest you to achieve your requirement using CellSelected event and EditCell method of Grid. refer the UG documentation for your reference   
 
Regards, 
Vignesh Natarajan 
 


Marked as answer

BF Brice FROMENTIN July 22, 2020 02:01 PM UTC

Many Thanks.


VN Vignesh Natarajan Syncfusion Team July 23, 2020 05:07 AM UTC

HI Brice,  

Thanks for the update.  

Kindly follow our Syncfusion site for release related updates.  

Please get back to us if you have further queries.  
  
Regards, 
Vignesh Natarajan  



Loader.
Up arrow icon