Flexgrid not displaying column if all the values in the column are null

Posted by: sandeep.a.kurup on 28 April 2020, 1:26 pm EST

    • Post Options:
    • Link

    Posted 28 April 2020, 1:26 pm EST

    I am loading flexgrid dynamically based on the records in “result”(PFB). But grid not displaying the column if all the values for a particular column in itemsSource is null.

    Eg : if “result” have 28 columns and out of that all the values for 3 columns are null then grid only displays 25 column by excluding these 3 columns

    I need to display all the columns in “result” even though if all the values for the particular column are null. Please advice

    <wj-flex-grid

    [itemsSource]=“result”

    [isReadOnly]=“true”

    [stickyHeaders]=“true”

    [showMarquee]=“false”

    [showSort]=“true”

    [allowAddNew]=“false”

    [allowDelete]=“false”

    (formatItem)=“formatItem(flexGrid,$event)”

    (itemsSourceChanged)=“itemsSourceChanged(flexGrid,$event)”

    (initialized)=“gridInitialized(flexGrid,$event)”>

    <wj-flex-grid-filter #gridFilter>

  • Posted 29 April 2020, 2:23 am EST

    Hi,

    This behavior is by design. The grid creates the columns on the basis of the data present in the binding. If there is not data present or all values of a binding is null, then the grid cannot infer the dataType and that’s why it does not create a column for null values.

    You will need to add the columns that are not present by iterating over each binding in the data source and if a column is not present of a particular binding, then create it manually.

    Please refer to the sample below for reference:

    https://stackblitz.com/edit/angular-z4shpk

    Regards,

    Ashwin

  • Posted 29 April 2020, 2:40 pm EST

    Thanks Ashwin for the help

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels