Smart-Table
Smart-Table copied to clipboard
stSearch and stSelectRow not working well together
Hi Lorenzo,
Just found that when combining stSearch and stSelecteRow an error is generated:
Error: [$compile:ctreq] Controller 'stTable', required by directive 'stSelectRow', can't be found!
Code looks like:
<table st-table="dataCollection" st-safe-src="dataSource" class="table table-striped table-bordered">
<thead>
<tr>
<th colspan="3">
<input st-search="" class="form-control" placeholder="Filter..." type="text"/>
</th>
</tr>
<tr>
<th st-ratio="20" st-sort="Column1">Column 1</th>
<th st-ratio="50" st-sort="Column2">Column 2</th>
<th st-ratio="30" st-sort="Column3">Column 3</th>
</tr>
</thead>
<tbody>
<tr st-select-row="row" st-select-mode="single" ng-repeat="row in dataCollection" ng-click="setSelection(row)">
<td>{{ row.Column1 }}</td>
<td>{{ row.Column2 }}</td>
<td>{{ row.Column3 }}</td>
</tr>
</tbody>
</table>
I use this table in a dialog, the first time the dialog pops up nothing happens and everything works fine, also filtering and selecting. When I close the popup, and open it up again, the search filter is cleared and the error above shows.
Do you have any idea why this happens, or is this a know issue?
This happens in version 2.1.0
Thanks in advance.
Jeroen
I have no idea, this looks more like a bug in angular as the controller st-table is indeed present. What version of angular are you using ?
I'm using AngularJS v1.3.15
what if you change your version ?
I'll give that a go, one moment.
Unfortunately using AngularJS v1.4.2 does not solve the problem, same error. I'll try and post a plunker tomorrow morning, so we can get to the bottom of this ;-)
Thank you for your help so far.
Hi Lorenzo,
Sorry for the late reply, but here is the plunk (procedure explained in plunk):
http://plnkr.co/edit/9rfHoFPDUQTgCbN1XTKT
If you have additional questions please let me know.
Thank you in advance for taking the time.
Regards,
Jeroen
Hi, I dont' see the procedure. Readme is empty. for me everything looks ok, does not it ?
Hi,
Just updated the README.md, but in short: http://plnkr.co/edit/9rfHoFPDUQTgCbN1XTKT?p=preview
1 Click button to choose person (modal show) 2 Enter value in the filter 3 Click close or choose button 4 Click button to choose person (modal show) 5 Look at error message:
Error: [$compile:ctreq] Controller 'stTable', required by directive 'stSelectRow', can't be found!
Looks like when the filter value is reset, the error shows, if you don't apply the filter then everything works just fine.
I am sorry but I think you are pointing me to the wrong plunker. I don't have modals, and readme is still empty
Hmm... weird, can you take a look again?
http://plnkr.co/edit/9rfHoFPDUQTgCbN1XTKT
Hi, ok I was able to reproduce, I don't know exactly the cause, it might be related to a node not disposed correctly, it might be related to angular strap, I don't know at the moment. I suggest you write your own selection logic (here is an example). I'll investigate
Hi Lorenzo,
Thank you for this workaround, works like a charm.
Cheers, Jeroen.