M
M
Mikha Pankratov2015-04-10 18:22:06
Yii
Mikha Pankratov, 2015-04-10 18:22:06

How to pass values ​​from element to js function?

Good day,
I got stuck on passing my parameters to the js function.

<?php foreach ($photos as $photo): ?>
        <?php
            $items[] = ['content' => '<div class="col-md-3 col-sm-4 col-xs-6 thumb">
                <img class="img-responsive" data-id="1" data-sort="13" src="'.Yii::$app->request->hostInfo.'/uploads/thumbnails/'.$photo->name.'" width="150px"/></div>'];
        ?>
    <?php endforeach; ?>
//я вывожу в витжет свои картинки, где перетаскивая их вызываю sortgallery( ) вот в нее то я и хочу передать свои data-//id и data-sort
<?php echo Sortable::widget([
    'type'=>'grid',
    'pluginEvents' => [
        'sortupdate' => 'function() { sortgallery(); }',
    ],
    'items' =>$items,
]);?>

tell me how to pass the data-id and data-sort I need to the sortgallery function?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
taurus90, 2015-04-10
@taurus90

json_encode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question