jaumard / ngx-dashboard

Dashboard library for angular 4 and more
https://jaumard.github.io/ngx-dashboard/demo/demoDist/index.html
MIT License
71 stars 31 forks source link

How to attach widget ID to dynamically created widget #46

Closed kaisako66 closed 5 years ago

kaisako66 commented 5 years ago

Kon'nichiwa watashi wa, dōteki ni seisei shita u~ijetto kara sakujo botan o ōka shi, dasshubōdokonpōnento-nai no removeItemById (id) o yobidashi, u~ijetto o sakujo shiyō to shite imasu. @ Output o shiyō shite, dasshubōdo ni ibento no hassei o dentatsu suru koto wa dekita yōdesuga, kanjin no u~ijetto ni ID ga settei sa rete inai yō ni omowa remasu. Damu o kakunin shite mo u~ijetto ID wa arimasendeshita. Rei: * < App - my - widget nghost - c 2 ="" class =" widget" style =" width: 345. 75 Px; haito: 150 Px; top: 1200 Px; refuto: 375. 75 Px;">< div ngcontent - c 2 ="" widgethandle =""> doraggu ME </ div > < p ngcontent - c 2 =""> my custom widget < b ngcontent - c 2 =""> wākusu </ b >! </ P > </ app - my - widget > addWidget ( )-nai de, widgetId ni atai o settei shite imasuga, dōteki ni seisei sa reta u~ijetto ni wa ID ga fura rete orazu, sakujo botan o oshite mo kinō shite inai yō ni omoimasu. Dōteki ni seisei sa reta u~ijetto ni WidgetID o settei suru hōhō wa nanika tokubetsuna sōsa ga hitsuyōna nodeshou ka yoroshiku onegai shimasu. さらに表示 731/5000 Hello

I press the remove button from the dynamically generated widget, call removeItemById (id) in the dashboard component, and use it to remove the widget.

It seems that we could communicate the occurrence of the event to the dashboard using @output,

It seems that ID is not set to the important widget.

I checked the DOM but there was no widget ID.

Example: ** <app-my-widget _nghost-c2 = "" class = "widget" style = "width: 345.75px; height: 150px; top: 1200px; left: 375.75px;" <div _ngcontent-c2 = "" widgethandle = "> DRAG ME </ div>

my custom widget works ! ************************************************** ******** In addWidget (), although the value is set to widgetId, it does not seem to ID is added to the dynamically generated widget, I think that it does not work even if you press the delete button. How do I set the WidgetID for dynamically generated widgets need some special handling? Thank you in advance.

kaisako66 commented 5 years ago

I'm sorry. It is embarrassing. The text before translation appeared.

kaisako66 commented 5 years ago

The problem is solved.

When creating a widget dynamically, it was because it was writing although widgetId did not need to be written in </ widgetId>.

It succeeded by specifying widgetId in INPUT.