mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 15:36:22 +08:00
Set table searchValue using table ref [SCI-10479]
This commit is contained in:
parent
d76fbf1eba
commit
3dea7c1e6d
|
@ -2,6 +2,7 @@
|
|||
<div class="h-full">
|
||||
<DataTable :columnDefs="columnDefs"
|
||||
:tableId="'ReportTemplates'"
|
||||
ref="table"
|
||||
:dataUrl="dataSource"
|
||||
:reloadingTable="reloadingTable"
|
||||
:toolbarActions="toolbarActions"
|
||||
|
@ -48,8 +49,12 @@ import UpdateReportModal from './modals/update.vue';
|
|||
|
||||
export default {
|
||||
name: 'ReportsTable',
|
||||
provide() {
|
||||
return { initSearchValue: this.initSearchValue };
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
if (this.searchValue) {
|
||||
this.$refs.table.searchValue = this.searchValue;
|
||||
}
|
||||
});
|
||||
},
|
||||
components: {
|
||||
DataTable,
|
||||
|
@ -64,7 +69,7 @@ export default {
|
|||
type: String,
|
||||
required: true
|
||||
},
|
||||
initSearchValue: {
|
||||
searchValue: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
|
|
|
@ -120,7 +120,6 @@ import RowMenuRenderer from './row_menu_renderer.vue';
|
|||
|
||||
export default {
|
||||
name: 'App',
|
||||
inject: ['initSearchValue'],
|
||||
props: {
|
||||
withCheckboxes: {
|
||||
type: Boolean,
|
||||
|
@ -335,9 +334,6 @@ export default {
|
|||
mounted() {
|
||||
this.navigatorCollapsed = document.querySelector('.sci--layout').getAttribute('data-navigator-collapsed') === 'true';
|
||||
this.setGridColsClass();
|
||||
if (this.initSearchValue) {
|
||||
this.searchValue = this.initSearchValue;
|
||||
}
|
||||
|
||||
window.addEventListener('resize', this.resize);
|
||||
},
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
available-columns-url="<%= available_asset_type_columns_path %>"
|
||||
available-rows-url="<%= available_rows_repositories_path %>"
|
||||
data-source="<%= reports_path(format: :json) %>"
|
||||
init-search-value="<%= params[:search] %>"
|
||||
search-value="<%= params[:search] %>"
|
||||
create-url="<%= new_report_path if can_create_reports?(current_team) %>"
|
||||
/>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue