Difference between #3 and #4 of
Batch Gridview data ajax send splitted in chunks displaying bootstrap Progress bar

Revision #4 has been created by toaster on Nov 21, 2018, 6:53:14 PM with the memo:

resize final gif
« previous (#3) next (#5) »

Changes

Title unchanged

Batch Gridview data ajax send splitted in chunks displaying bootstrap Progress bar

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

AJAX,gridview,Progressbar,batch data send

Content changed

[...]
});

```
The first three functions take care to show, update and hide the progress bar inside the modal window, while the `batchSend` function perform the array split and, using recursion, send the data through post ajax request, encoding the array as JSON string and calling itself until there is no more chunks to send. The last lines of code bind the click event of the `#batch_process` button checking if at least one row of Gridview has been selected. The number of elements on each array chunk can be set as the third argument of the `batchSend` function (in my case 5), you can adjust it accordingly. The first parameter is the whole array obtained by the `yiiGridView('getSelectedRows')` function.
The final result is something like this:
<img src="https://www.dijackfantasy.com/batch_send.gif" style="width:150%
;height:auto" /> ...looks cool, isn't it?
8 0
2 followers
Viewed: 33 006 times
Version: 2.0
Category: Tutorials
Written by: toaster
Last updated by: toaster
Created on: Nov 21, 2018
Last updated: 5 years ago
Update Article

Revisions

View all history