作者:Carmen果果时代 | 来源:互联网 | 2023-07-16 18:55
Ivebeenusingjsfiddle.nettotryandprototypeaschedulerwheretheitemstobescheduledaredr
I've been using jsfiddle.net to try and prototype a scheduler where the items to be scheduled are dragged and dropped into it. I've gotten dragging and dropping from an "unassigned" list and onto the schedule table working. I've also gotten the ability to remove from the schedule table working. What I'm having a difficult time wrapping my head around is moving an item in the table to another part of the table.
我一直在使用jsfiddle.net尝试并原型化一个调度程序,在这个调度程序中,要调度的项目被拖放到其中。我已经从一个“未分配的”列表中拖拽到进度表中。我还能够从日程表表中删除工作。我正处在一个困难的时刻,把我的头绕在桌子上,把一个东西移到桌子的另一边。
The fiddle is located here. I'd appreciate any suggestions on getting internal drag and drop to work. I've been working on this all day and I'm starting to get blurry vision. Oh, and by all means if you think what I'm doing can be done better, please make the change, just let me know what version the fiddle is up to.
小提琴在这里。如果您能给我一些建议,我将不胜感激。我整天都在做这个,我的视野开始模糊。哦,当然,如果你认为我所做的可以做得更好,请做出改变,告诉我小提琴演奏的版本。
UPDATE
更新
As per @SMathew and @darksky I've rebuilt the whole fiddle where I'm not directly shifting the table cells around, but instead their content.
根据@SMathew和@darksky,我重建了整个小提琴,我不是直接移动表格单元格,而是它们的内容。
I know you guys recommended using div
s and/or span
s, but I want to use the structure of the table, especially the rowspan
to designate the height of the cell in 30 minute increments. It does work a lot better now, with the only bug being moving cells (or moreso their contents) around because I have to restore cells affected by the rowspan
at the source site and remove the cells that will conflict with the rowspan
at the target site.
我知道你们建议使用div和/或span,但是我想使用表的结构,尤其是行span,以30分钟的增量指定单元格的高度。现在它确实工作得好多了,唯一的bug是移动的细胞(或moreso的内容),因为我必须恢复被源站点的rowspan影响的细胞,并移除与目标站点上的rowspan冲突的单元格。
The updated fiddle can be found here.
更新的小提琴可以在这里找到。
UPDATE 2 (FINAL)
更新2(最终)
So, I went back to the drawing board again, and after 64 fiddles, I finally got it to do what I want. In the end, the trick to get everything to work fine without manipulating the structure of the table. All I had to do was set cells that are in the way of a rowspan to display: hidden
.
所以,我又回到了画板上,经过了64个小提琴,我终于让它做我想做的事情。最后,在不操纵表的结构的情况下使所有东西正常工作的技巧。我所要做的就是设置单元格,这些单元格将以行间距的方式显示:hidden。
Anyway, for anyone whose interested, the new fiddle is here. I did discover that Chrome has some issues handling the API. I've noted them in the fiddle (along with a partial rant).
不管怎样,对于任何感兴趣的人来说,新提琴就在这里。我确实发现Chrome在处理API时存在一些问题。我已经注意到他们在小提琴(以及部分咆哮)。
1 个解决方案