JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Data Grid How to pass data type dynamically in grid column

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #101577
    Gourav
    Member
    Up
    0
    Down

    Hi team,
    We are following – https://www.htmlelements.com/angular/demos/grid/server-side-paging-sorting-filtering/
    we would like to create dynamic columns and data fields (i.e <span class=”pln”>dataFields, columns) means – -> we have columns and datatype field list in backend and we want to use those, instead of static fields like in the example.</span>
    We are trying to create the array object dynamiclly but it is failing. Can you suggest the issue
    Example –
    <div>
    <div>this.elements.forEach(element => {</div>
    <div>const object= {</div>
    <div>label: element.label,</div>
    <div>dataField: element.field_name}</div>
    <div>}</div>
    <div>this.columns.push(object)</div>
    <div>const column=element.field_name+’:’+type;</div>
    <div>this.dataFields.push(column);</div>
    <div>});</div>
    </div>
    <div>some home it create array of strings. and it does not works</div>

    #101579
    Gourav
    Member
    Up
    0
    Down

    <div>
    this.elements.forEach(element => {
    const object= {
    label: element.label
    dataField: element.field_name}
    }
    this.columns.push(object)
    const column=element.field_name+’:’+type;
    this.dataFields.push(column);
    });
    some home it create array of strings. and it does not works

    #101581
    yavordashew
    Member
    Up
    0
    Down

    Hi Gourav,
    From what you shared as a code I was unable to reproduce the issue you encounter.
    It will be the best to share a code example in order to give you the best solution.
    However I would suggest you to check the demos regarding data binding of the grid which use Smart.DataAdapter
    https://www.htmlelements.com/angular/demos/grid/datagrid-bind-to-json/
    Please, do not hesitate to contact us if you have any additional questions.
    Best regards,
    Yavor Dashev
    Smart UI Team
    https://www.htmlelements.com/

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.