[cocos2d-html5][Resolved] cc.TableView not addChild increase ccs.UIPanel?

[cocos2d-html5][Resolved] cc.TableView not addChild increase ccs.UIPanel?
0.0 0


With Javascript/Web project this code will work:
tableCellAtIndex:function (table, idx) { var cell = table.cellAtIndex(idx); var _item = null; if (!cell) { cell = new CustomTableViewCell(); _item = ccs.GUIReader.getInstance().widgetFromJsonFile(res.sjs_gui_ui_Scroll_tactics_list); _item.setTag(10); _item.setName("_formationitem"+idx); cell.addChild(_item); cell.getChildrenCount(); } else { _item = cell.getChildByTag(10); } return cell; },

cell.addChild (_item);—> without error, but you can not add
cell.getChildrenCount(); —> 0;


I need more code to test.
i don’t have res.sjs_gui_ui_Scroll_tactics_list and so on.


res.sjs_gui_ui_Scroll_tactics_list corresponding json file


Run the code


cocos2d-html5 2.2.1 版本

浏览器日志: cc.Node.addChild(): child already added. It can’t be added again。

*item = ccs.GUIReader.getInstance.widgetFromJsonFile
*item._parent: undefined

if (child._parent !== null) {
cc.log(“cc.Node.addChild(): child already added. It can’t be added again”);


tactics_no.png、p1.png also can‘t got.
ui_sprites_Background is not a function.


在html5 2.2.1 版本,用非 ccs.Widget 控件 addChid()方法加载 ccs.widget 控件有问题。因为 ccs.GUIReader.getInstance().widgetFromJsonFile 获取的对象都没有 _parent 属性。
在 CCNode.js 类, addChid()方法中会使用到_parent 属性。


我刚才用cocos2d-html5-develop 版本测试,已经不会出问题了! 谢谢大神回答。


you are welcome! please write in english next time.