ciena-frost / ember-frost-table

MIT License
1 stars 9 forks source link

Custom cell renderer for ember frost table not working if column is passed as bunsen view and the renderer property is set on the column inside the bunsen view. #49

Closed address2sunil closed 6 years ago

address2sunil commented 6 years ago

The ember table API https://ciena-frost.github.io/ember-frost-table/#/frost-table shows how to apply a renderer on a column value for table to render a cell of the column according to the criteria implemented in the cell renderer. This API expects the renderer to be specified as below. The API behaves as expected if the renderer is specified inside column while the ‘columns’ property value is passed directly (e.g. via computed property from the consuming component’s js file). {{frost-table       columns=(array         (hash           label='Real Name'           propertyName='realName'           renderer=(component 'text-input-renderer')         )       )       hook='myTable'       items=heroes   }}

However, if the ‘columns’ property’s value is passed in form of ‘Bunsen View’ values as is the case in our application, the cell renderer specified for a particular column for that ‘Bunsen View’ does not work as expected.  Here is how we pass the ‘columns’  property to frost-table :   {{frost-table class="setTableBorder"
               columns=model.bunsenView
               items=bunsenValues
               itemKey=model.itemKey
               selectedItems=selectedItems
               onSelectionChange=(action 'onSelectionChange')
               onCallback=callback
}}   we apply the renderer inside the view for a column as below. In this case the column values are getting blanked out and we don’t see the control being returned to the renderer/component.   'vlanfixedtableviews': {
  'data': [
     {
      'attributes': {
         'version': '2.0',
         'type': 'form', 
        'id': '1',
         'jsondata': [
           {
             'propertyName': 'vlanName',
             'label': 'VLAN name',
             'renderer': {
               'name' : 'nm-frost-table-renderer'
             } ]}}]}   I am suspecting a bug in Bunsen/frost-table which seems to prevent the capability to apply custom cell renderer if ‘columns’ are Bunsen View instead of directly applying the ‘columns’ computed property from the consumer component of the frost table.  

notmessenger commented 6 years ago

This is not a bug, as ember-frost-table was not developed with any specific support for ember-frost-bunsen. The renderer property in ember-frost-table is not being passed the correct data in the expected format, as shown in your example.

address2sunil commented 6 years ago

Thanks for pointing this out. closing the bug.