Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
620
Blazor Grid IgbCellTemplateContext Row Data
posted

I need access to the Row Data from within the Body Template; at the moment I can only get the Value of the passed in data. Will this be coming soon as I need to make a discission on what suite of controls to use for an upcoming project. Until this is possible the current grid is no use.

Parents
  • 34810
    Offline posted

    Hello David,

    You can access the grid’s row object from the IgbCellTemplateContext in your BodyTemplate handler using the following code, where "GetBodyTemplate" would be hooked into the corresponding column's BodyTemplate property:

        public RenderFragment GetBodyTemplate(IgbCellTemplateContext ctx)
        {
            IgbGridCellIdentifier id = ctx.Cell.Id;

            IgbRowType row = this.GridRef.GetRowByIndex(id.RowIndex);

            var dataItem = row.Data;

            return@<div>your_template_here</div>;
        }

    I hope this helps you. Please let me know if you have any other questions or concerns on this matter.

Reply Children