简体   繁体   English

Javascript Grid UI-可拖动和可调整大小

[英]Javascript Grid UI - Draggable & Resizeable

I am not sure if this is the correct place to ask such a question but I am looking to find a javascript component which does the following functions: 我不确定这是否是提出此类问题的正确地点,但我正在寻找一个具有以下功能的javascript组件:

  • Have an amount of columns / rows 有一定数量的列/行
  • The grid will have several items in it, the width of the items can spread multiple columns and rows but fits in the grid 网格中将包含多个项目,项目的宽度可以分散多列和多行,但适合网格
  • User must be able to drag elements around but not overlapping other elements 用户必须能够在周围拖动元素,但不能与其他元素重叠
  • User must be able to resize elements in all directions but again, not overlapping other elements 用户必须能够在所有方向上调整元素的大小,但不能与其他元素重叠
  • Attach to events on resize / drag in order to communicate such changes with backend 附加到调整大小/拖动的事件,以便与后端交流此类更改

The image below depicts a visual example of what I am looking for. 下图描绘了我正在寻找的视觉示例。 In the below example, the X-axis would represent time slots while the Y-axis would represent Table Nos and hence the red blocks below are denoting: 在下面的示例中,X轴表示时隙,而Y轴表示表号,因此下面的红色方框表示:

  • Table #2 allocated from 12:00 - 15:00 表#2从12:00-15:00分配
  • Table #4 allocated from 15:00 - 17:00 表4从15:00-17:00分配
  • Table #6 & 7 allocated from 14:00 - 16:00 表#6和7从14:00-16:00分配

网格UI示例

I'm not sure if it was available when you needed it, but gridster seems to do everything you are after. 我不确定在您需要它时是否可用,但是gridster似乎可以满足您的所有需求。

After several researching and didn't manage to find something suitable, I just made something simple using jQueryUI as a proof of concept which can be seen on my pen on CodePen which supports the creation of a 5 x 5 grid, sample 3 'booked slots' which you can drag on the pink slots and resizeable. 经过几番研究后,我并没有找到合适的方法,我只是使用jQueryUI简化了一些概念,这在我的CodePen笔上可以看到,它支持创建5 x 5网格,示例3个预订的插槽'您可以在粉红色插槽上拖动并调整大小。

Unfortunately, jQueryUI has got a bug which is quite old and have never been fixed which is revert 'invalid' with grid doesn't return to start position with jQuery UI Draggable . 不幸的是,jQueryUI有一个非常老的错误,并且从未得到修复,该错误在使用网格恢复为“无效”时不会通过jQuery UI Draggable返回到开始位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM