I’m using ListView to create a navigation list. navigation list is based on <ul> and <li>
In the resulting html output there are additional div tags surrounding every model output. like:
<div id="w1"> <div data-key="4"><li><a href="#Abrar">Abrar</a></li></div>
which are generated automatically.
Is there any way to prevent ListView from generating this additional divs?
Or is there any other way too loop through Models(rendering a view file) other than using ListView widget?
Thanks in advance.
Yes, just like mentioned here http://www.yiiframework.com/doc-2.0/guide-output-data-widgets.html#listview you can set your own view file with everything rendered just like you want it.
Couldn’t figure it out to have ListView functionality to word while it doesn’t generate <div data-key=“index”> tags
I solved it out by not using ListView and instead looping directly through Models and generating html.
You can put to false tag index in ‘itemOptions’:
'dataProvider' => $listDataProvider,
'itemView' => '_list_item',
'summary' => '',
'itemOptions' => [
'tag' => false
'options' => [
'class' => 'news-v2 margin-bottom-50',
'id' => false