You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+110-1Lines changed: 110 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,8 @@ TODO UPDATE CHANGELOG
35
35
* Select display columns
36
36
* Pagination
37
37
* On Table Editing
38
+
* Remote data loading
39
+
* Remote data processing
38
40
39
41
40
42
## Requirements
@@ -182,6 +184,21 @@ Or add the js script to your html (download from [releases](https://github.com/j
182
184
required: false,
183
185
default: 10,
184
186
},
187
+
/**
188
+
* If loading of table is to be done through ajax, then this object must be set
189
+
*/
190
+
ajax: {
191
+
type: Object,
192
+
required: false,
193
+
default: function () {
194
+
return {
195
+
enabled: false,
196
+
url: "",
197
+
method: "GET",
198
+
delegate: false,
199
+
}
200
+
}
201
+
},
185
202
},
186
203
187
204
```
@@ -217,6 +234,92 @@ Column with Title "Name" , which is visible and editable:
217
234
}
218
235
```
219
236
237
+
### AJAX Configuration
238
+
239
+
Ajax Object properties:
240
+
241
+
* enabled : to enable loading through ajax call, enable this
242
+
* url: the URL where to request the data
243
+
* methods:GET and POST are the valid methods allowed
244
+
* delegate: False = just get all the data and do processing on browser; True = Ask for data as needed, and all processing is done on the server side.
245
+
246
+
247
+
#### Example AJAX config for Remote Loading
248
+
249
+
This configuration will only make one request to the server, to get all the data and load it straight into the browser.
250
+
251
+
```javascript
252
+
ajax: {
253
+
enabled: true,
254
+
url: "http://localhost:9430/data/test",
255
+
method: "GET",
256
+
delegate: false,
257
+
},
258
+
```
259
+
260
+
#### Example AJAX config for Remote Processing
261
+
262
+
This configuration will only make many requests to the server, each time data ir needed, or any processing is required:for filtering, ordering, pagniation, changes of page size, etc.
263
+
264
+
```javascript
265
+
ajax: {
266
+
enabled: true,
267
+
url: "http://localhost:9430/data/test",
268
+
method: "GET",
269
+
delegate: true,
270
+
},
271
+
```
272
+
273
+
### Ajax Request and Expected Response
274
+
275
+
#### Ajax Request Parameters Sent
276
+
277
+
When Ajax is enabled, the following parameters are sent with each request for the URL specified:
278
+
279
+
-`sortcol`: The name of the column to sort by (only sent when `delegate` is true, otherwise will be null)
280
+
-`sortdir`: The sorting direction "ASC" or "DESC" (only sent when `delegate` is true, otherwise will be null)
281
+
-`filter`: The filter to be used (only sent when `delegate` is true, otherwise will be null)
282
+
-`page`: The number of the page being requested ( when delegate is false, it will always be 1 )
283
+
-`pagesize`: The number of records being requested.
284
+
-`echo`:A unique number for the request.
285
+
286
+
#### Ajax Expected Response
287
+
288
+
For all requests, vue-bootstrap-table expects an object of the following type:
289
+
290
+
```javascript
291
+
{
292
+
echo: INTEGER,
293
+
filtered: INTEGER,
294
+
data: [OBJECT],
295
+
},
296
+
```
297
+
298
+
Where:
299
+
300
+
-`echo`: is the same integer the request provided.
301
+
-`filtered`: is the total amount of entries for the request, and is used for pagination
302
+
-`data`: is an ArrayofObjectwith the entries.
303
+
304
+
Example:
305
+
306
+
```javascript
307
+
{
308
+
echo: 1,
309
+
filtered: 2000,
310
+
data: [
311
+
{
312
+
id: 1,
313
+
name: "Rui"
314
+
},
315
+
{
316
+
id: 2,
317
+
name: "Gustavo"
318
+
},
319
+
],
320
+
},
321
+
```
322
+
220
323
## Events
221
324
222
325
*`cellDataModifiedEvent`- When a cell is edited, an `cellDataModifiedEvent`event is dispatched.
@@ -250,14 +353,20 @@ If you have a feature request, please add it as an issue or make a pull request.
0 commit comments