Yii layered ajaxLink

I am developing a three level menu on my website and I am using yii as php-framework.

For instance:

Itema
 Item_a1
   Item_a11
   Item_a12
 Item_a2
Itemb
 ...

For some reason, I would like to use ajax to generate these sub_items.

So I wrote CHtml :: ajaxLink ("ItemA", url, ...); and it works great for creating second-level items, i.e. Item_a1, Item_a2, ....

My problem is when I use CHtml :: ajaxLink ("Item_a1", url, ...); for ajax to generate 3rd level, it cannot work.

My assumption is that the second time I generate ajaxLink using the renderPartial method, yii did not inject the appropriate jscript into the view, so the link cannot work.

, , , ! !

+3
1

, , , renderPartial(), JS-, . - :

$this->renderPartial(
  '_partialview', // your menu view
  array(), // data/variables for your view
  false, // whether it should print or return the buffered output
  true, // "processOutput" - false by default, this should output your JS now
);

!

+2

Source: https://habr.com/ru/post/1794380/


All Articles