Potreboval bych se zbavit parametru z url

Honza.Mottl
Člen | 104
+
0
-

potreboval bych se zbavit parametru z url.
Na to by melo pomoci $this->redirect($destination); bez parametru.
Je to ve funkci, ktera se vola z vice presenteru. Jak zjistim to $destination z aktualniho presenteru? Diky.

Pavel Kravčík
Člen | 1180
+
0
-

Pokud je to perstistentní parametr musíš ho uvést s NULL → tj. $this->redirect('this', ['destination' => NULL']); a na zjištění GET parametru můžeš použít $this->getParameter(), případně interní funkce $this->getAction();.

Honza.Mottl
Člen | 104
+
0
-

Diky. Zjistim to v komponente a to nebude to spravne misto pro redirect, pada to na vyjimce. Budu to muset resit jinak. Zkusim to orezat o krok pozdeji v js.

Honza.Mottl
Člen | 104
+
0
-

nakonec jsem nasel zpusob jak to udelat v js.
https://stackoverflow.com/…reshing-page

function removeGetParameretsIfReset() {
// get the string following the ?
    var isReset = window.location.href.indexOf('resetGrid') !== -1;

// is there anything there ?
    if(isReset) {
        // are the new history methods available ?
        if(window.history != undefined && window.history.pushState != undefined) {
            // if pushstate exists, add a new state the the history, this changes the url without reloading the page

            window.history.pushState({}, document.title, window.location.pathname);
        }
    }
}