Hello,
I’m trying to use a Smart View to display a list of Users with a specific template.
And I would like to trigger my SmartAction “Connect As User” that is available on my table User.
This smart action works fine with the classic table view on forest admin but not inside my smartview.
I followed the documentation that specifies this implementation to trigger an action inside the smartview:
{{button/beta-button
type='primary'
text='Reschedule appointment'
action=(action 'triggerSmartAction' collection 'Reschedule' record)
}}
I replaced the example values with my values. This happens inside my for each loop where the record is displayed and accessible.
{{button/beta-button
type='primary'
text='Connect as user'
action=(action 'triggerSmartAction' collection 'Connect as user' record)
}}
<div class="c-smart-view">
<div class="c-smart-view__content">
<span class="c-smart-view_icon fa fa-{{@collection.iconOrDefault}} fa-5x"></span>
<h1>
</h1>
<p>
<h1>Liste de clients ({{@recordsCount}})</h1>
{{collection}}
<table style="width:100%">
<tr>
<th>ID</th>
<th>Email</th>
<th>Entreprise</th>
<th>Actions</th>
</tr>
{{#each records as |record|}}
<tr>
<td class="tableCell">{{record.id}}</td>
<td class="tableCell">{{record.forest-email}}</td>
<td class="tableCelle">{{record.forest-companyName}}</td>
<td class="tableCell">
{{button/beta-button
type='primary'
text='Connect as user'
action=(action 'triggerSmartAction' collection 'Connect as user' record)
}}
</td>
</tr>
{{/each}}
</table>
</p>
<button/beta-button {{action 'fetchRecords'}}>
Refresh data
</button>
</div>
</div>
import Component from '@ember/component';
import { triggerSmartAction, deleteRecords, getCollectionId, loadExternalStyle, loadExternalJavascript } from 'client/utils/smart-view-utils';
export default class extends Component {
}
Expected behavior
The Action should be triggered
Actual behavior
When I press the button, the spinner is running.
The button seems to indicate that something is loading, but nothing happens
Context
Please provide any relevant information about your setup.
- Package Version:
"dependencies": {
"axios": "^0.21.0",
"chalk": "~1.1.3",
"cookie-parser": "1.4.4",
"cors": "2.8.5",
"debug": "~4.0.1",
"dotenv": "~6.1.0",
"express": "~4.16.3",
"express-jwt": "5.3.1",
"forest-express-sequelize": "6.7.6",
"morgan": "1.9.1",
"pg": "8.5.1",
"require-all": "^3.0.0",
"sequelize": "6.5"
}