Stop URL overwritting upon ordering of Gridview

I have a form in which I call

echo \Yii::$app->runAction('employees-documents/employees-documents-index', ['id'=>$model->EmployeeId]);

To renderAjax() a view containing a Gridview widget. This all works fine. That said, when the user clicks on one of the Gridview headers to order the results, it goes and changes page/form the URL based on the gridview and causes problems. How can I stop this?

Can you provide more code examples for this? Is the URL path in the correct pattern when you hover over the link?

What code would you like?

I am in one view, so 2 models - regular and search and a controller, in which I then call another controller’s action to render it’s view within the original view. So lots of code here.

Originally, the model update form loads just fine and the url is fine, but when I filter/sort the other view’s gridview it overrides the URL with its search url.

I’ve also tried by doing

echo $this->renderAjax('_form_escort_documents', 
                                            ['model' => $model, 
                                            'form' => $form]);

but this also suffers from the same issue.

I open the form in a modal window to edit the entry, when you click on any header within that gridview it changes the pages url to refelect that Gridview’s url/sort so when pjax refreshes it loads that rather than the original index page which called the modal.

So is there are way to allow the filtering/sorting, as it does work, but stop it from changing the page’s url?

I’d still love to learn how to incorporate another view with a Gridview within an existing view without it overwriting the url, but in the meantime I have come up with a workaround, which is to disable the natural GridView sorting and implement my own javascript table sorting. It is actually much faster as it isn’t performing any server side work, just sorting what is already there.