Dynamic binding custom columns

Posted by: bemes9226 on 11 November 2020, 11:55 pm EST

  • Posted 11 November 2020, 11:55 pm EST

    i have 10 columns name in json data all coming dynamically.but i want add dropdown filed where the col==country.

    <wj-flex-grid [itemsSource]=“data”>

    <wj-flex-grid-column *ngFor=“let col of columns” [header]=“col” [binding]=“col”>

    <template wjFlexGridCellTemplate *ngIf=“col==‘country’” [cellType]=“‘CellEdit’” let-cell=“cell”>

    <wj-combo-box [itemsSource]=“countries”[displayMemberPath]=“‘country’” [selectedValuePath]=“‘country’” [(selectedValue)]=“cell.value”>





  • Posted 12 November 2020, 1:52 pm EST

    already populated country values in the grid but i want bind custom field as a dropdown.below is the json format.

    how can i write custom country cell dynamic.

    i have tried this bu not getting.

    <wj-flex-grid-column *ngFor=“let col of columns” [header]=“col” [binding]=“col”>

    <template wjFlexGridCellTemplate *ngIf=“col==‘country’”…

    {

    “ClientD”:9,

    “ClientIds”:6,

    “Names”:robert,

    “Numbers”:890,

    “Action”:0,

    “country”:india,

    “InUse”:true,

    “IsSubscribed”:true,

    “IsTRTA”:false,

    “Jurisdiction”:null,

    “LocationIds”:null,

    },{

    “ClientD”:8,

    “ClientIds”:7,

    “Names”:tim,

    “Numbers”:90,

    “Action”:0,

    “country”:us,

    “InUse”:true,

    “IsSubscribed”:true,

    “tsg”:false,

    “diction”:null,

    “LocationIds”:null,

    },

  • Posted 13 November 2020, 3:02 am EST

    Hi bemes9226,

    You have the component for creating cell templates instead of directive. The template directive does not support let-cell. Please refer to the sample link below for reference:

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

    Regards,

    Ashwin

  • Posted 17 November 2020, 1:38 am EST

    Hi bemes9226,

    The columns of FlexGrid cannot be created by this type of structure. You need a flat array for creating columns, something like this:

    columns = [
    	{
            DataType: 1,
            FilterValues: null,
            Id: "wf_14",
            IndexTypeId: 0,
            IsRequired: false,
            IsVisible: false,
            LookupId: 2,
            Name: "Jurisdiction",
            SelectedValue: null,
            colIdentity: "JURISDICTIONS"
          },
    {
            DataType: 7,
            FilterValues: [
              {
                Id: 0,
                Identity: null,
                Name: " "
              },
              {
                Id: 0,
                Identity: null,
                Name: "CORPORATE INCOME TAX"
              },
              {
                Id: 0,
                Identity: null,
                Name: "VALUE ADDED TAXES"
              },
              {
                Id: 0,
                Identity: null,
                Name: "STATUTORY FINANCIAL STATEMENTS"
              },
    
              {
                Id: 0,
                Identity: null,
                Name: "BOOKKEEPING"
              },
              {
                Id: 0,
                Identity: null,
                Name: "GENERAL"
              },
              {
                Id: 0,
                Identity: null,
                Name: "TRANSFER PRICING"
              },
              {
                Id: 0,
                Identity: null,
                Name: "TEST 1Q"
              }
            ],
            Id: "fldr_8",
            IndexTypeId: 0,
            IsRequired: false,
            IsVisible: false,
            LookupId: 0,
            Name: "Tax Type",
            SelectedValue: null,
            colIdentity: "TAXTYPE"
          }
    ]
    

    ~regards

Need extra support?

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

Learn More

Forum Channels