Revision #4 was created by toaster on Nov 21, 2018, 6:53:14 PM.
resize final gif
Content
[...]
});
```
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?