Created
September 26, 2014 12:05
-
-
Save otakustay/c45d0d5b910427e5b635 to your computer and use it in GitHub Desktop.
Extern search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.search = function () { | |
var event = { | |
filterData: [] | |
}; | |
event = this.fire('search', event); | |
if (!event.preventDefault()) { | |
// 如果没有外部提供搜索条件,就自个儿玩 | |
if (this.searchBox) { | |
var defaultFilter = { | |
value: this.getChild('search-box').getValue() | |
}; | |
event.filterData.push(defaultFilter); | |
} | |
} | |
this.searchByFilters(event.filterData); | |
}; | |
exports.searchByFilters = function (filters) { | |
// ... | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.activate = function () { | |
this.$super(arguments); | |
this.target.on( | |
'search', | |
function (e) { | |
var filter = { | |
value: this.locateSearchBox().getValue(); | |
}; | |
e.filterData.push(filter); | |
e.preventDefault(); | |
} | |
this | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.activate = function () { | |
this.$super(arguments); | |
this.target.on( | |
'search', | |
function (e) { | |
var filters = u.chain(this.locateSelects()) | |
.invoke('getValue') | |
.map(function (value) { return {value: value}; }) | |
.value(); | |
e.filterData.push(filter); | |
e.preventDefault(); | |
} | |
this | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<esui-search-box data-ui-id="foo"></esui-search-box> | |
<esui-select data-ui-id="alice"></esui-select> | |
<esui-select data-ui-id="bob"></esui-select> | |
<esui-table-rich-select data-ui-id="data" | |
data-ui-search-box-filter-type="SeachBoxFilterCollector" | |
data-ui-search-box-filter-search-box="foo" | |
data-ui-select-filter-type="SelectFilterCollector" | |
data-ui-select-filter-selects="alice bob"> | |
</esui-table-rich-select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment