Skip to content

Commit 6e85e35

Browse files
committed
fix searchable failure on column level.
1 parent c41931b commit 6e85e35

File tree

3 files changed

+46
-42
lines changed

3 files changed

+46
-42
lines changed

dist/aha-table.html

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -177,24 +177,25 @@
177177
<tr class="search-head {{ searchable ? '' : 'hide'}}">
178178
<th>{{searchtitle}} </th>
179179
<th template
180-
repeat="{{ column in meta }}"
181-
class="{{ column.searchable ? 'searchable' : 'hide'">
182-
<select
183-
on-change="{{ search }}"
184-
class="{{ 'choice' === column.type ? '' : 'hide' }}">
185-
<option template
186-
repeat="{{ option in column.options }}"
187-
value="{{ option.value }}">
188-
{{ option.label }}
189-
</option>
190-
</select>
191-
<input type="checkbox"
192-
on-change="{{ search }}"
193-
class="{{ 'boolean' === column.type ? '' : 'hide' }}"/>
194-
<input type="text"
195-
on-keyup="{{ search }}"
196-
placeholder?="{{ column.searchplaceholder }}"
197-
class="{{ 'choice' !== column.type && 'boolean' !== column.type ? '' : 'hide' }}"/>
180+
repeat="{{ column in meta }}">
181+
<div class="{{ column.searchable ? 'searchable' : 'hide'}}">
182+
<select
183+
on-change="{{ search }}"
184+
class="{{ 'choice' === column.type ? '' : 'hide' }}">
185+
<option template
186+
repeat="{{ option in column.options }}"
187+
value="{{ option.value }}">
188+
{{ option.label }}
189+
</option>
190+
</select>
191+
<input type="checkbox"
192+
on-change="{{ search }}"
193+
class="{{ 'boolean' === column.type ? '' : 'hide' }}"/>
194+
<input type="text"
195+
on-keyup="{{ search }}"
196+
placeholder?="{{ column.searchplaceholder }}"
197+
class="{{ 'choice' !== column.type && 'boolean' !== column.type ? '' : 'hide' }}"/>
198+
</div>
198199
</th>
199200
</tr>
200201
</thead>
@@ -490,8 +491,9 @@
490491
}
491492
},
492493
sort: function(e, p) {
493-
if(e.target.templateInstance.model.column){
494-
var sortingColumn = e.target.templateInstance.model.column.name;
494+
var column = e.target.templateInstance.model.column;
495+
if(column && column.sortable){
496+
var sortingColumn = column.name;
495497
if (sortingColumn == this.sortedColumn){
496498
this.descending = !this.descending;
497499
} else {

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ <h2>Advanced usage: themed, customized columns, customized attributes, customize
7878
removeclass="fa fa-trash-o">
7979
<aha-column name="title"
8080
type="string"
81-
sortable="true"
81+
sortable="false"
8282
searchable="true"
8383
required="true"
8484
editable="false"
@@ -89,7 +89,7 @@ <h2>Advanced usage: themed, customized columns, customized attributes, customize
8989
<aha-column name="date"
9090
type="date"
9191
sortable="true"
92-
searchable="true"
92+
searchable="false"
9393
required="true"
9494
editable="true"
9595
placeholder="Choose your date"

src/aha-table.html

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -177,24 +177,25 @@
177177
<tr class="search-head {{ searchable ? '' : 'hide'}}">
178178
<th>{{searchtitle}} </th>
179179
<th template
180-
repeat="{{ column in meta }}"
181-
class="{{ column.searchable ? 'searchable' : 'hide'">
182-
<select
183-
on-change="{{ search }}"
184-
class="{{ 'choice' === column.type ? '' : 'hide' }}">
185-
<option template
186-
repeat="{{ option in column.options }}"
187-
value="{{ option.value }}">
188-
{{ option.label }}
189-
</option>
190-
</select>
191-
<input type="checkbox"
192-
on-change="{{ search }}"
193-
class="{{ 'boolean' === column.type ? '' : 'hide' }}"/>
194-
<input type="text"
195-
on-keyup="{{ search }}"
196-
placeholder?="{{ column.searchplaceholder }}"
197-
class="{{ 'choice' !== column.type && 'boolean' !== column.type ? '' : 'hide' }}"/>
180+
repeat="{{ column in meta }}">
181+
<div class="{{ column.searchable ? 'searchable' : 'hide'}}">
182+
<select
183+
on-change="{{ search }}"
184+
class="{{ 'choice' === column.type ? '' : 'hide' }}">
185+
<option template
186+
repeat="{{ option in column.options }}"
187+
value="{{ option.value }}">
188+
{{ option.label }}
189+
</option>
190+
</select>
191+
<input type="checkbox"
192+
on-change="{{ search }}"
193+
class="{{ 'boolean' === column.type ? '' : 'hide' }}"/>
194+
<input type="text"
195+
on-keyup="{{ search }}"
196+
placeholder?="{{ column.searchplaceholder }}"
197+
class="{{ 'choice' !== column.type && 'boolean' !== column.type ? '' : 'hide' }}"/>
198+
</div>
198199
</th>
199200
</tr>
200201
</thead>
@@ -490,8 +491,9 @@
490491
}
491492
},
492493
sort: function(e, p) {
493-
if(e.target.templateInstance.model.column){
494-
var sortingColumn = e.target.templateInstance.model.column.name;
494+
var column = e.target.templateInstance.model.column;
495+
if(column && column.sortable){
496+
var sortingColumn = column.name;
495497
if (sortingColumn == this.sortedColumn){
496498
this.descending = !this.descending;
497499
} else {

0 commit comments

Comments
 (0)