0

Given the row data as follows :

rowData = [ 
    { field_1 : value_1_1 , field_2 : value_1_2 , colSpan : 1 } , 
    { field_1 : value_2_1 , colSpan : 2} , 
    { field_1 : value_3_1 , field_2 : value_3_2 , colSpan : 1} 
];

Column definitions as follows :

columnDefs = [ 
    {
        header  : field_1_name , 
        field   : field_1 , 
        colSpan : getColSpan(params) 
    } , 
    {   
        header : field_2_name , 
        field  : field_2  
    } 
];

For the getColSpan fucntion , what TypeScript syntax can be used to implement the pseudo snippet below ? :

getColSpan(params) 

    return colSpan value for each row 

The resulting grid should be as below : see screenshot here

1 Answer 1

1

As mentioned in the demo example Simple Column Spanning, you can have colSpan function as below to get the result you're expecting.

{
    header  : field_1_name, 
    field   : field_1,
    colSpan : function(params) {
      var value = params.data.field_1;
      if (value === "value_2_1") {
        return 2;
      } else {
        return 1;
      }
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.