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

tabs does not update

Hi.
I want to display a  tab if I check and do not display if i Uncheck .


@page "/"
<EjsTab @ref="sourceTab" CssClass="e-fill" EnableRtl="true" OverflowMode="OverflowMode.Scrollable" HeightAdjustMode="HeightStyles.None" Height="390px" ShowCloseButton="false">
    <TabEvents></TabEvents>
    <TabItems @ref="@TabItems1">

        <TabItem @ref="@a">
            <ChildContent>
                <TabHeader Text="aaaaaaa"></TabHeader>
            </ChildContent>

            <ContentTemplate>
                <div class="btn-container">
                    <EjsCheckBox EnableRtl="true" Label="همه اطلاعات بالا مورد تاییدم است." @bind-Checked="IsAccepted"></EjsCheckBox>
                </div>
            </ContentTemplate>
        </TabItem>
        @if(IsAccepted )
        { 
        <TabItem @ref="@b">
            <ChildContent>
                <TabHeader Text="bbbbbbbbb"></TabHeader>
            </ChildContent>

            <ContentTemplate>
                <p>bbbbb</p>
            </ContentTemplate>
        </TabItem>
        }
        <TabItem @ref="@c">
            <ChildContent>
                <TabHeader Text="cccccccccccc"></TabHeader>
            </ChildContent>

            <ContentTemplate>
                <p>cccccccccccccc</p>
            </ContentTemplate>
        </TabItem>

    </TabItems>
</EjsTab>
  EjsTab sourceTab;
    TabItem a ;
    TabItem b;
    TabItem c;
    bool IsAccepted =false;
}

Attachment: tabUpdate_2fd2ef00.rar

1 Reply

NR Nevitha Ravi Syncfusion Team November 7, 2019 01:19 PM UTC

Hi Ebi, 

Greetings from Syncfusion Support. 

We have checked the case at our end, since we could not add or remove the tab items based on the condition provided in the shared code we suggest you to use Disabled property using which we can dynamically enable or disable a tab item based on the conditions. Also, currently we have a breaking issue to use Disabled property that will work on our 17.3.17 ej2.min.js file. We will include the issue fix in our upcoming patch release expected to be rolled out in the mid of November 2019. You can keep track of the issue form the following link. 

Meanwhile we suggest you to use our 17.3.17 CDN links and for the same we have shared a sample for your reference that can be downloaded from the following link. 

<EjsTab @ref="sourceTab" CssClass="e-fill" EnableRtl="true" OverflowMode="OverflowMode.Scrollable" HeightAdjustMode="HeightStyles.None" Height="390px" ShowCloseButton="false"> 
    <TabEvents></TabEvents> 
    <TabItems @ref="@TabItems1"> 
        <TabItem @ref="@a"> 
            <ChildContent> 
                <TabHeader Text="aaaaaaa"></TabHeader> 
            </ChildContent> 
            <ContentTemplate> 
                <div class="btn-container"> 
                    <EjsCheckBox EnableRtl="true" Label="همه اطلاعات بالا مورد تاییدم است." @bind-Checked="IsAccepted"></EjsCheckBox> 
                </div> 
            </ContentTemplate> 
        </TabItem> 
            <TabItem Disabled="IsAccepted" @ref="@b"> 
                <ChildContent> 
                    <TabHeader Text="bbbbbbbbb"></TabHeader> 
                </ChildContent> 
                <ContentTemplate> 
                    <p>bbbbb</p> 
                </ContentTemplate> 
            </TabItem> 
        <TabItem @ref="@c"> 
            <ChildContent> 
                <TabHeader Text="cccccccccccc"></TabHeader> 
            </ChildContent> 
            <ContentTemplate> 
                <p>cccccccccccccc</p> 
            </ContentTemplate> 
        </TabItem> 
    </TabItems> 
</EjsTab> 
 
@code{ 
    EjsTab sourceTab; 
    TabItem a; 
    TabItem b; 
    TabItem c; 
    bool IsAccepted = true; 
} 

Kindly try the suggested solution and get back to us if you have any further queries. 

Regards, 
Nevitha. 


Loader.
Live Chat Icon For mobile
Up arrow icon