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

Complier warning adding custom toolbar item to tree grid

Hi,

Getting the following warnings when setting a custom toolbar item on the tree grid. Is there a better way to do this i.e. in markup?

warning BL0005: Component parameter 'Template' should not be set outside of its component.

warning BL0005: Component parameter 'Align' should not be set outside of its component.

    <SfTreeGrid @ref=@TreeGridRiskFlows ID="RiskFlows" DataSource=@NetworkAssetModelList IdMapping=@nameof(NetworkAssetModel.RowId) ParentIdMapping=@nameof(NetworkAssetModel.ParentRowId)

                TreeColumnIndex="1" AllowPaging="true" AllowSorting="true" AllowResizing="true" AllowTextWrap="true" EnablePersistence="false"

                Toolbar=@(new List<object>() { "Search", new ToolbarItem() { Template = this.FilterRenderFragment, Align = ItemAlign.Left } })>


1 Reply

PS Pon Selva Jeganathan Syncfusion Team October 7, 2022 01:41 PM UTC

Hi Michael Aston,


Thanks for contacting syncfusion forum.


Query: Getting the following warnings when setting a custom toolbar item on the tree grid. Is there a better way to do this i.e. in markup?


We checked your query by preparing a sample, we were able to reproduce the issue at our end. To avoid this warning issue, we suggest you disable the warning using the below code snippet,


<SfTreeGrid DataSource="@TreeData" TValue="BusinessObject" IdMapping="TaskId" ParentIdMapping="ParentId" TreeColumnIndex="1" Height="100%"            AllowSorting="false" EnableAltRow="false"

Toolbar="@(new List<object>() {

      #pragma warning disable BL0005

    new ToolbarItem()

                        { Template = Text, Id = "text", TooltipText = "Text", Align = ItemAlign.Right,  

                        },

                   new ToolbarItem()

                        { Template = CheckBox, Id = "checkbox", TooltipText = "CheckBox", Align = ItemAlign.Right,

                        },

                   new ToolbarItem()

                        { Template = Button, Id = "button", TooltipText = "Button", Align = ItemAlign.Right, 

                        }

                        #pragma warning restore BL0005      

                    })"            ..>  

 



Please refer to the sample,

https://www.syncfusion.com/downloads/support/directtrac/general/ze/Treegrid-blazor146389825


Kindly get back to us for further assistance.


Regards,

Pon selva


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.



Loader.
Live Chat Icon For mobile
Up arrow icon