D
D
Dmitry Kim2016-03-30 14:01:11
Yii
Dmitry Kim, 2016-03-30 14:01:11

Can you help me overcome the "weird" behavior of Pjax in YII2?

There is a GridView with an action column, where the Update button calls a modal window with a pjax form for editing. On the page, it's all scattered like this:

<Pjax1>
  <GridView>
  </GridView>
</Pjax1>
...разная дрянь...
<Modal>
  <Pjax2>
    <Form></Form>
  </Pjax2>
</Modal>

The form has the data-pjax attribute and works fine. Upon completion, updates the jacket for the grid:
$('#pjax2').on('pjax:end', function(){
  $('#modal').modal('hide');
  $.pjax.reload('#pjax1');
});

Everything works with one strange bug: the data in the grid is either not updated (although there are changes in the database), or after updating one row out of say 10, sometimes 6 rows are loaded into the grid, it happens in different ways.
BUT! If you open the chrome developer panel and turn on network tracking with a checkmark on "disable cache" - voila, everything works like clockwork - everything changes and all data is relevant after any update of any line.
Apparently something with the browser cache and the jacket, how can this be overcome with the forces of the jacket or Yui herself?
PS: Elsewhere a simple GridView + Pagination + Pjax works flawlessly.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton, 2016-03-30
@karminski

You write that "elsewhere ... works without jambs." Play the game "find 10 differences".

N
Nikita, 2016-03-31
@bitver

If the cache interferes with you, disable it in pjax, what's the problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question