angular2-grid icon indicating copy to clipboard operation
angular2-grid copied to clipboard

Add support for fixed items

Open BTMorton opened this issue 10 years ago • 12 comments

The title says it all. It's kinda rubbishy and unpredictable atm

BTMorton avatar Aug 16 '15 20:08 BTMorton

Hi, when redoing the cascading, maybe could you add an option to have some tiles that dont move. I've added some column 'headers' to my grid, which are undraggable boxes, but they still get moved by cascading. Maybe I could find another way to make headers, but there are other boxes I would like to be unmovable, which would be in the middle of a column.

pocmanu avatar Nov 09 '15 06:11 pocmanu

I have added a 'fixed' field to the config that stop it being cascaded. I also added 'draggable' and 'resizable' fields that can disable for an individual item too. I just added them as they seemed like 'quick wins' :P I'll probably get to this issue one day...

BTMorton avatar Nov 10 '15 23:11 BTMorton

Yeah quick wins is what I thought about it, this is why I suggested it. I've played with your new features, but now I understand better the cascading feature and in the use case I'm working on (a kind of scheduling agenda), I don't need cascading. What I need is free-placing, moving/resizing, collision and truly fixed boxes (reserved areas where you cannot put any box). Currently, the 'fixed' boxes can still be moved by dragging any box over them.

pocmanu avatar Nov 12 '15 08:11 pocmanu

Ah, OK. So what I made as the current 'fixed' should really be 'cascadable' and then add a new fixed property that means it doesn't move ever. Shouldn't be too hard... He says... Will require changing the drag and resize events in nggrid to check if the item you're dragging into can move. I'll take a look, see what I can do

BTMorton avatar Nov 12 '15 08:11 BTMorton

@pocmanu take a look at the fixed_items branch and see if that fits your requirements? 31ee2caf5d07bdec9eab876a846e23eaf39e0c46

BTMorton avatar Jan 05 '16 21:01 BTMorton

@BTMorton This seems perfect. I won't have much time to use it in the next couple of weeks (new baby coming), I just noted a small mistake in the demo, I think item in col 3 / row 4 should be named 'Cascade, can't drag, can't resize'

pocmanu avatar Jan 08 '16 07:01 pocmanu

@pocmanu I've updated the fixed_items branch with the latest changes from master. If you get the chance to have a look. I'll probably merge it into master some point soon

BTMorton avatar Apr 30 '16 03:04 BTMorton

@BTMorton I've finally managed to have the demo app running and it's working great. The distinction between fixed=true (cannot be moved through cascading by others) and can_cascade=false (cannot create cascading on others) was not clear at the first time. I think you should fix the readme about this though I am not an english native and I don't find a good way to describe both features.

pocmanu avatar May 03 '16 11:05 pocmanu

OK, I'll see if I can clarify it a bit. I'm thinking about adding yet another config option is_sticky which means that it won't be moved by another dragged item, and then fixed would be can_cascade=false,can_drag=false,can_resize=false,is_sticky=true and the current fixed property would equal can_cascade=false,is_sticky=true. Thoughts on that? I'm not entirely sure how it would work, though, I'll admit :P

BTMorton avatar May 04 '16 18:05 BTMorton

My thoughts on that :

  • you shouldn't add properties that are a combination of others, it will be too confusing
  • is_sticky is a good wording for fixed : an item that cannot be moved by other (can be resized or not, dragged or not, there are other properties if you want to tweak)
  • the only wording I'm not sure of is can_cascade but I'm not able to find anything better. Maybe with something like "Indicates whether the item can force other to cascade when dragging upon them" as a description will be sufficient.

pocmanu avatar May 09 '16 12:05 pocmanu

Yeah, the can_cascade could be encompassed in is_sticky. So a sticky item won't move in any situation, unlike how can_cascade works at the moment. That loses some flexibility though. I'm thinking of adjusting how the cascade works anyway which would hopefully make things more clear. I'll keep thinking on it...

BTMorton avatar May 09 '16 12:05 BTMorton

Hi. do you have any plans to merge this into master? Thanks for your good work

maariioo avatar Oct 05 '16 16:10 maariioo