Perspective Table Dropdown Cell View Problem

ignition80
#1

Hi all,

I am trying to populate a dropdown cell in a perspective table component with a viewPath, viewParams, and render=“view” set in a particular column in the table.props.columns property.

However, i’d like this dropdown to be able to register the particular row/col that it is in so once edited, it can send a value to the correct place based on row/col. The cell commit script does not fire, unless there is some way to hook this cell view to the table to make it work in that manner. Any ideas?

Additionally, is it possible to pre-populate the dropdown in the cell based on row/col? I only know its association with column index/name since that is where it is defined. My workaround for this is to use a message handler to initially populate all of those views based on the rows they reside in.

Cheers,
Roger

0 Likes

#2

I have essentially the same question, but more fundamentally: how does one embed a dropdown in a perspective table for a given column and how, as the original poster asked, do I access the updated value of the dropdown?

0 Likes

#3

I can answer the former for you - on the chart component, there is a property called columns (self.props.columns) which is a list that holds multiple fields, one per item, e.g.

props.columns[0]
props.columns[1]

props.columns[ncols]

You can assign the field, the render type, the viewPath, and viewParams inside whichever column you need the dropdown at. You’ll have to assign a dropdown component inside a view that will be passed into the viewPath/viewParams parameters, e.g.

props.columns[0].field = “Column Name”
props.columns[0].render = “view”
props.columns[0].viewPath = “path/to/dropdown”
props.columns[0].viewParams = {“value”:1}
etc.

This would give you a view containing a dropdown in column 0 with the column named “Column Name” and inserted parameter “value” with a value of 1.

But honestly, it could be easier to just use a flex repeater and message handlers to get better output than embedding a view in a table - I can’t find any way to get the output from it without knowing what rowIndex it came from.

Cheers,
Roger

0 Likes

#4

Since 8.0.2 there is a implicit rowData property passed to the view configured for a column. This property contains not only the configured column but the complete row data. So if your row has a unique id property, that property is available in your view and can be used e.g. in a OnActionPerformed event of your dropdown.

1 Like

#5

Hi,

Sorry for the delay. Did you manage resolve your issue? What @chi suggested should work. Let us know. Thanks!

-Y

0 Likes