简体   繁体   English

UI可用性-重新排序和合并列

[英]UI Useability - Reordering and merging columns

I'm writing a little web-based utility for my brother who needs to merge columns in a CSV file. 我正在为我的兄弟编写一个基于Web的实用工具,该兄弟需要合并CSV文件中的列。 I know things like this surely exist somewhere, but a large part of this is that is a fun little exercise. 我知道这样的事情肯定存在于某处,但是其中很大一部分是有趣的小练习。

Anyways, I'm trying to figure out the best/neatest way to present the part of the UI where he reorders the columns and chooses which columns get merged. 无论如何,我正在尝试找出最好/最近的方式来呈现UI的一部分,在该部分中他可以对列进行重新排序并选择要合并的列。

The jQuery UI "selectable" interaction provides about 85% of what I need - the simple reordering of the columns - but I'm having a bit of a rough time with the merging. jQuery UI的“可选”交互提供了我所需的大约85%的内容-列的简单重新排序-但合并时我的工作有些艰难。 What I'm trying to do is make it so that "merged" columns become a nested list under a single item. 我正在尝试做的是使“合并的”列成为单个项目下的嵌套列表。

For example: 例如:

<ul id="columns">
<li>Column 1</li>
<li>Column 2</li>
</ul>

would become: 会成为:

<ul id="columns">
<li>Column 1<ul class="merge"><li>Column 2</li></ul></li>
</ul>

This is proving to be a bit more of a pain than I anticipated, so I was wondering if anyone had any ideas for a better way to present the overall UI. 事实证明,这比我预料的要痛苦得多,所以我想知道是否有人对如何更好地呈现整体UI有任何想法。 I'm fairly comfortable in jQuery, so bonus points if it can be done in jQuery :D 我对jQuery非常满意,因此如果可以在jQuery中完成,则可以加分:D

@dylanfm: This isn't tabular data - it's just a list of column names , but no actual data. @dylanfm:这不是表格数据-只是列列表,但没有实际数据。 Besides, the specific HTML element I use is hardly at the heart of what I'm asking. 此外,我使用的特定HTML元素几乎不是我要问的核心。

@smo: I like the simplicity of your idea, but the problem is that there are several dozen different columns, so listing every column once per column would unfortunately be out of the question. @smo:我喜欢您的想法的简单性,但是问题是有几十个不同的列,因此不幸的是,每列只列出一次。

@strager: That's pretty much exactly what I've been trying to do, it's just that particulars of making UI respond the way I want have been giving me problems. @strager:那几乎就是我一直在尝试做的,只是让UI响应我想要的方式给我带来问题的细节。 I'll give you the answer for now, and I guess it's back to the salt mines for me. 我现在给你答案,我想这已经回到了我的盐矿上。

Basic steps: 基本步骤:

  1. Grab the list of columns to be merged as an array of <li>'s. 抓取要合并为<li>数组的列列表。
    • If you're merging two already-merged columns (or one of the colums is already merged), extract each column in the group. 如果要合并两个已经合并的列(或其中一个列已被合并),请提取组中的每个列。 In your structure, you'd want to make "Column 1" have its own <li> without the child <ul>. 在您的结构中,您希望使“列1”具有自己的<li>而没有子<ul>。
    • You'd probably want to clone these, as you'll be deleting the original nodes in (6). 您可能想要克隆它们,因为您将要删除(6)中的原始节点。
  2. Create a new <ul> node, adding the proper "merged" className. 创建一个新的<ul>节点,添加适当的“合并” className。
  3. Add all the <li>'s you gathered in (1), except the first one, and insert them as children to the <ul>. 添加您在(1)中收集的所有<li>,第一个除外,并将它们作为子代插入<ul>。
  4. Insert the <ul> as the last child of the first <li> you gathered in (1). 插入<ul>作为您在(1)中收集的第一个<li>的最后一个子项。
  5. Insert the <li> (parent in (4)) as a child of the column list ($('#columns')). 插入<li>(在(4)中的父级)作为列列表($('#columns'))的子级。
  6. Delete the original columns which you were going to merge. 删除要合并的原始列。

我想坚持使用表格来处理表格数据,无序列表似乎不太适合内容。

暂无
暂无

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

相关问题 根据元素列表的顺序对Kendo UI Grid列进行重新排序 - Reordering of Kendo UI Grid columns based on the order of a list of elements jqGrid列重新排序但不保存订单 - jqGrid Columns reordering but not saving the order 为什么jQuery UI Sortable不再对元素进行重新排序? - Why is jQuery UI Sortable not reordering the elements anymore? jQuery UI Tabs:如何实现拖放式AJAX重新排序? - jQuery UI Tabs: How to implement drag and drop AJAX reordering? ui与jqGrid一起用于列重新排序时的多选定制 - ui Multiselect customization when used with jqGrid for column reordering Kendo UI Grid Reorderable Rows 没有从下往上正确地重新排序 - Kendo UI Grid Reorderable Rows not reordering properly from bottom up 重新排序列,虚拟滚动,jqgrid中的gridResize不起作用 - Reordering columns, Virtual scroll, gridResize in jqgrid does not work 在HTML中交叉合并表的列和行 - Cross Merging Table Columns and Row in HTML 无法防止使用jqgrid重新排序列。 我想禁用库本身,这将是一个通用解决方案 - Unable to prevent reordering of columns using jqgrid. I want to disable in the library itself that would be a generic solution 页面重新加载后,Slickgrid 列重新排序不会保持相同的 position。 如何为 slickgrid 中的列保留相同的 position? - Slickgrid column reordering is not holding the same position after the page reload. How to hold the same position for the columns in slickgrid?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM