holubj / NiftyGrid

DataGrid for Nette Framework
34 stars 34 forks source link

Redirect problem with ajax editation #39

Open thaarok opened 11 years ago

thaarok commented 11 years ago

When I submit row add, it works, but doesnt appear - I must refresh page.

First HTTP request and reponse:

POST /crm/www/zakaznik/detail?id_zakaznik=106&do=skupinaZakaznikGrid-gridForm-submit
{"redirect":"http:\/\/localhost\/crm\/www\/zakaznik\/detail?id_zakaznik=106&_fid=ftz1"}

Second HTTP request and reponse:

GET http://localhost/crm/www/zakaznik/detail?id_zakaznik=106&_fid=ftz1
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
...

Server evidently sends HTML instead of JSON.

I resolve it by commenting out redirect() in Grid::rowFormSubmitted():

    public function rowFormSubmitted($values, $gridName)
    {
        ...
        //$this->redirect("this"); // JK: cause problems with ajax editation
    }

Better idea?