Skip to content

Commit 199cd4e

Browse files
M Shafique QadriM Shafique Qadri
authored andcommitted
Server Searching
1 parent f555f67 commit 199cd4e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Pagination
1313
- Localization
1414
- Fuzzy searching
15+
- Server searching
1516
- Excel export
1617
- Printing
1718
- Custom topbar buttons
@@ -112,6 +113,8 @@ clickable => Rows are clickable. => true (default)
112113
sortable => Cause column-click to sort => true (default) // Whether sortable
113114
searchable => Add fuzzy search functionality => true (default) // Whether searchable
114115
exactSearch => Disable fuzzy search => true (default) // Whether only exact matches are returned
116+
serverSearch => Server search is used to fetch data from server => false (default) // If you wanna do server search then searchable and serverSearch must be true and use serverSearchFunc as callback.
117+
serverSearchFunc => Function for search search => function // For this searchSearch criteria is must.
115118
paginate => Add footer next/prev. btns => true (default) // Whether paginated
116119
exportable => Add button to export to Excel => true (default) // Whether exportable
117120
printable => Add printing functionality => true (default) // Whether printable

src/DataTable.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,17 @@
128128
type: Boolean,
129129
default: false
130130
},
131+
serverSearch: {
132+
type: Boolean,
133+
default: false
134+
},
135+
serverSearchFunc: {
136+
type: Function
137+
},
131138
paginate: {default: true},
132139
exportable: {default: true},
133140
printable: {default: true},
134-
locale: {default: 'en'},
141+
locale: {default: 'en'}
135142
},
136143
137144
data: () => ({
@@ -313,6 +320,12 @@
313320
})
314321
315322
if (this.searching && this.searchInput) {
323+
324+
if(this.serverSearch) {
325+
this.serverSearchFunc(this.searchInput)
326+
return
327+
}
328+
316329
const searchConfig = { keys: this.columns.map(c => c.field) }
317330
318331
// Enable searching of numbers (non-string)

0 commit comments

Comments
 (0)