{"action":"created","issue":{"url":"https://api.github.com/repos/luyadev/luya/issues/1830","repository_url":"https://api.github.com/repos/luyadev/luya","labels_url":"https://api.github.com/repos/luyadev/luya/issues/1830/labels{/name}","comments_url":"https://api.github.com/repos/luyadev/luya/issues/1830/comments","events_url":"https://api.github.com/repos/luyadev/luya/issues/1830/events","html_url":"https://github.com/luyadev/luya/issues/1830","id":338565016,"node_id":"MDU6SXNzdWUzMzg1NjUwMTY=","number":1830,"title":"LazyLoad widget don't work in another widget","user":{"login":"cheerymagicsoftware","id":25486166,"node_id":"MDQ6VXNlcjI1NDg2MTY2","avatar_url":"https://avatars1.githubusercontent.com/u/25486166?v=4","gravatar_id":"","url":"https://api.github.com/users/cheerymagicsoftware","html_url":"https://github.com/cheerymagicsoftware","followers_url":"https://api.github.com/users/cheerymagicsoftware/followers","following_url":"https://api.github.com/users/cheerymagicsoftware/following{/other_user}","gists_url":"https://api.github.com/users/cheerymagicsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/cheerymagicsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cheerymagicsoftware/subscriptions","organizations_url":"https://api.github.com/users/cheerymagicsoftware/orgs","repos_url":"https://api.github.com/users/cheerymagicsoftware/repos","events_url":"https://api.github.com/users/cheerymagicsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/cheerymagicsoftware/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-05T13:01:40Z","updated_at":"2018-07-05T14:13:19Z","closed_at":null,"author_association":"NONE","body":"### What steps will reproduce the problem?\r\nUsing widget LazyLoad in another widgets (For example ListView).\r\nI add this widget in 'itemView' partial view of ListView widget.\r\n\r\n\r\n### What is the expected result?\r\nlazyload.js must load.\r\n\r\n### What do you get instead? (A Screenshot can help us a lot!)\r\nDon`t load lazyload.js lib.\r\n\r\n\r\n### LUYA Check ouput (run this script and post the result: [luyacheck.php](https://gist.github.com/nadar/022f890e064c068e75ce6178cd14a09e))\r\n\r\n---\r\n\r\n### Additional infos\r\nIt's happend because static::$counter of class Widget  already has counted +1 in ListView widget. \r\nIn my case, I extended LazyLoad class and add local counter:\r\n```\r\n<?php\r\n...\r\nclass LazyLoadExt extends Widget\r\n{\r\n    ...\r\n    public static $localCounter = 0;\r\n    ...\r\n    public function init()\r\n    {\r\n         ...\r\n         static::$localCounter++;\r\n         static::$counter++;\r\n\r\n         if (static::$localCounter== 1) {\r\n             LazyLoadAsset::register($this->view);\r\n             $this->view->registerJs(\"$('.lazy-image').lazyLoad();\", View::POS_READY);\r\n             $this->view->registerCss(\".lazy-image { display: none; }\");\r\n         }\r\n     }\r\n     ...\r\n}\r\n?>\r\n```\r\n\r\n| Q                | A\r\n| ---------------- | ---\r\n| LUYA Version     |  1.0.7\r\n| PHP Version      | 7.1\r\n| Platform         | XAMPP\r\n| Operating system | Windows"},"comment":{"url":"https://api.github.com/repos/luyadev/luya/issues/comments/402735887","html_url":"https://github.com/luyadev/luya/issues/1830#issuecomment-402735887","issue_url":"https://api.github.com/repos/luyadev/luya/issues/1830","id":402735887,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjczNTg4Nw==","user":{"login":"cheerymagicsoftware","id":25486166,"node_id":"MDQ6VXNlcjI1NDg2MTY2","avatar_url":"https://avatars1.githubusercontent.com/u/25486166?v=4","gravatar_id":"","url":"https://api.github.com/users/cheerymagicsoftware","html_url":"https://github.com/cheerymagicsoftware","followers_url":"https://api.github.com/users/cheerymagicsoftware/followers","following_url":"https://api.github.com/users/cheerymagicsoftware/following{/other_user}","gists_url":"https://api.github.com/users/cheerymagicsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/cheerymagicsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cheerymagicsoftware/subscriptions","organizations_url":"https://api.github.com/users/cheerymagicsoftware/orgs","repos_url":"https://api.github.com/users/cheerymagicsoftware/repos","events_url":"https://api.github.com/users/cheerymagicsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/cheerymagicsoftware/received_events","type":"User","site_admin":false},"created_at":"2018-07-05T14:13:19Z","updated_at":"2018-07-05T14:13:19Z","author_association":"NONE","body":"Maybe... :)"}}
{"actor":{"display_login":"cheerymagicsoftware"}}