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

Dragging not working when other component selector includes. #30

Open Sandeepvedam opened 7 years ago

Sandeepvedam commented 7 years ago

Hi,

First, Thanks for great plugin. :)

I am facing issue that is widget not dragging when i included table component selector inside widget tag.

Code:

<widget [size]="[5,3]" widgetId="big" class="handle">
        <data-table >
        </data-table>
      </widget>

Please help me.

Thanks, Sandeep.

jaumard commented 7 years ago

Hello,

So data-table is another angular component right ? Did it use some events ? Because maybe it intercept events and make the dragging not working...

Sandeepvedam commented 7 years ago

Yes. data-table is another component. I have not used events in table component. I have mentioned event(onDrag) in dashboard tag. Can i mention same to data-table selector?

jaumard commented 7 years ago

The onDrag event will work only for the widget itself, not child components I will try to reproduce the problem, if you have the possibility to create a small project to reproduce the problem it can help me see what's wrong. I never encounter this before

Sandeepvedam commented 7 years ago

Yes. I will create sample project. So that we can reproduce the problem

Sandeepvedam commented 7 years ago

Hello,

Here is the GIT repo : https://github.com/Sandeepvedam/angular-widgets

jaumard commented 7 years ago

Thanks ! I'll take a look asap and let you know :)

Sandeepvedam commented 7 years ago

Okay. Thanks

jaumard commented 7 years ago

I take a quick look and it's weird should work... On my project I do like this https://github.com/mylisabox/lisa-ui/blob/master/src/app/components/widget/widget.component.html#L1 with the widgethandle directive but can't test on your sample as there some compilation errors (but I was able to run it)... The only difference is that on my project I add widgets dynamically where you add them statically so maybe there a problem there. Can you test to play with the directive and let me know please ?

Sandeepvedam commented 7 years ago

I saw your code. It is making some what confusion to me with out running the application. When i run the app it is failing API calls. :)

Sandeepvedam commented 7 years ago

I added something like below. Is that correct format.

widgets = [ { "id": 1, "name": "DataTable", "size": [ 4, 3 ] }, { "id": 2, "name": "BarChart", "size": [ 2, 2 ] } ];

image

Still i am not able to drag. May be way of writing code is wrong in my case. Can you please help me :)

jaumard commented 7 years ago

As I say it may not be because of your code if widgets with basic HTML inside are draggable... Maybe something is wrong on the library code for static widgets (as you can see mine are not added there https://github.com/mylisabox/lisa-ui/blob/master/src/app/pages/home/home.component.html#L54, they are added dynamically). I need to dig more into this see what wrong... I'll try to reproduce on my demo project, it will be easier to see what's wrong there. Thanks for the feedback !

Sandeepvedam commented 7 years ago

Thank you very much.

We can not drag one widget into available space. image

Let's say from above image. I can't drag table widget beside to chart widget. It will be good if you provide this kind of features.

http://angular-dashboard-framework.github.io/angular-dashboard-framework/#/sample/01 http://wrapbootstrap.com/preview/WB0573SK0

jaumard commented 7 years ago

I don't plan to do such feature as I don't need it (I made this project for my L.I.S.A. project to manage widget dashboard) and the behavior I want for this project is this one. I think to do such feature you need to change the all algorithm to be able to do that because the current one only place widget on the next available position and it's not aware of anything else, there no real grid or something. Maybe I'm wrong but doesn't sound like an easy task to me.

The link you provide they work with a grid and widget are resized depending on this grid, here there no grid but widgets have size and are placed one after the other on the next available position.

Sorry for me English I hope I'm clear ^^

Sandeepvedam commented 7 years ago

Okay. No problem.

However , Thank you very much for this plugin.

jaumard commented 7 years ago

You're welcome :) I'll try to fix this problem asap

Sandeepvedam commented 7 years ago

Hi,

Widget not adding with width and height if i push another object to below data dynamically.

widgets = [ { "id": 1, "name": "DataTable", "size": [ 4, 3 ] }, { "id": 2, "name": "BarChart", "size": [ 2, 2 ] } ];

how to update dashboard in above scenario?

jaumard commented 7 years ago

On the demo app here is how I've done it https://github.com/jaumard/ngx-dashboard/blob/master/demo/src/app/app.component.ts#L48

Sandeepvedam commented 7 years ago

Hi,

Custom Widget component is adding successfully. I found one issue. please use ngOnInit in Custom widget component then add widget component. You can see as it appears in the top.

jaumard commented 7 years ago

Hello,

Did you call super.ngOnInit on yours ?

Sandeepvedam commented 7 years ago

When i call super.ngOnInit() in ngOnInit. It's disturbing UI. UI not similar to ngOnInit

jaumard commented 7 years ago

What do you mean by that ? As I do some stuff on it https://github.com/jaumard/ngx-dashboard/blob/master/src/components/widget/widget.component.ts#L19 if you don't call the super class it can do strange stuff, try copy/paste this line on your see if it's better

Sandeepvedam commented 7 years ago

Yes. I resolved it by ngIf condition. However i am calling super.ngOnInit(). It's problem with styling in my component. Thank you very much. :)

sudhakar-sekar commented 6 years ago

Same issue I am also facing, trying to drag the data table from another child component. Dragging is not working. Can anyone tell me any solutions.

rasmani795 commented 4 years ago

Inside some content is there means I can't drag. The drag is working on widget tag only. Inside is not working. Can you help me.