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
close icon

grid command do nat work in tabs(hosted core)

<EjsGrid Width="100%" TValue="GridFields" DataSource="@GridData" EnableRtl="true" AllowTextWrap="true">
                                                    <GridEditSettings AllowAdding="true" AllowDeleting="true"></GridEditSettings>
                                                    <GridColumns>
                                                        <GridColumn Field=@nameof(GridFields.TrainNo) HeaderText="Train No" Width="120" Type="@ColumnType.Number"></GridColumn>
                                                        <GridColumn Field=@nameof(GridFields.Name) Width="140"></GridColumn>
                                                        <GridColumn HeaderText="حذف" Width="20">
                                                            <GridCommandColumns>
                                                                <GridCommandColumn Type="CommandButtonType.Edit" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-edit", CssClass="e-flat" })"></GridCommandColumn>
                                                                <GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-delete", CssClass="e-flat" })"></GridCommandColumn>
                                                                <GridCommandColumn Type="CommandButtonType.Save" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-save", CssClass="e-flat" })"></GridCommandColumn>
                        <GridCommandColumn Type="CommandButtonType.Cancel" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-cancel", CssClass="e-flat" })"></GridCommandColumn>
                                                            </GridCommandColumns>
                                                        </GridColumn>

                                                    </GridColumns>
                                                </EjsGrid>

3 Replies

SK Satheesh Kumar Balasubramanian Syncfusion Team September 30, 2019 11:42 AM UTC

Hi Ebi, 
 
Greetings from Syncfusion support. 
 
We have validated the reported issue with shared code snippet and found that you have missed to set the properties  “AllowEditing” and “IsPrimaryKey” as true in GridEditSettings and GridColumn tag respectively which is the cause for the reported problem. 
 
Refer the below code snippet to overcome the reported issue.  
 
@using Syncfusion.EJ2.Blazor.Navigations 
@using Syncfusion.EJ2.Blazor.Grids 
 
<EjsTab> 
    <TabItems> 
        <TabItem> 
            <ChildContent> 
                <TabHeader Text="Grid"></TabHeader> 
            </ChildContent> 
            <ContentTemplate> 
                <EjsGrid TValue="GridFields" DataSource="@GridData" EnableRtl="true" AllowTextWrap="true"> 
                    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings> 
                    <GridColumns> 
                        <GridColumn Field=@nameof(GridFields.TrainNo) HeaderText="Train No" IsPrimaryKey="true" Width="120" Type="@ColumnType.Number"></GridColumn> 
                        <GridColumn Field=@nameof(GridFields.Name) Width="140"></GridColumn> 
                        <GridColumn HeaderText="حذف" Width="20"> 
                            <GridCommandColumns> 
                                <GridCommandColumn Type="CommandButtonType.Edit" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-edit", CssClass="e-flat" })"></GridCommandColumn> 
                                <GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-delete", CssClass="e-flat" })"></GridCommandColumn> 
                                <GridCommandColumn Type="CommandButtonType.Save" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-save", CssClass="e-flat" })"></GridCommandColumn> 
                                <GridCommandColumn Type="CommandButtonType.Cancel" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-cancel", CssClass="e-flat" })"></GridCommandColumn> 
                            </GridCommandColumns> 
                        </GridColumn> 
                    </GridColumns> 
                </EjsGrid> 
            </ContentTemplate> 
        </TabItem> 
    </TabItems> 
</EjsTab> 
 
 
@code{ 
    public List<GridFields> GridData { get; set; } 
 
    protected override void OnInitialized() 
    { 
        GridData = Enumerable.Range(1, 5).Select(x => new GridFields() 
        { 
            TrainNo = 1000 + x, 
            Name = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)] 
        }).ToList(); 
    } 
 
    public class GridFields 
    { 
        public int? TrainNo { get; set; } 
        public string Name { get; set; } 
    } 
 
} 
 
 
 
Please try out the solution and let us know if you need any further assistance. 
 
Regards, 
Satheesh Kumar B 



ET ebi torabi October 4, 2019 05:28 PM UTC

Hi Satheesh Kumar B 
Thanks for your great support


NR Nevitha Ravi Syncfusion Team October 7, 2019 04:57 AM UTC

Hi Ebi, 

You are most welcome.! Please let us know if you need any further assistance. 

Regards, 
Nevitha 


Loader.
Live Chat Icon For mobile
Up arrow icon