我必须维护大量经典的ASP页面,其中许多页面都有表格数据,根本没有排序功能。无论原始开发人员在数据库查询中使用的顺序是什么,都将使您陷入困境。

我想给这些页面添加一些基本的排序,我用javascript在客户端完成。我已经完成了对给定列上的给定表按照给定方向进行排序的基本脚本,只要表受到我们在这里遵循的某些约定的限制,它就能很好地工作。

我想为UI做的是用插入符号(^)指明排序方向,然后。什么?是否有一个特殊的字符是与插入符号相反的?字母v不太合适。或者,是否有其他角色配对我可以使用?


当前回答

你能用document。write在span中绘制svg路径吗?span不是svg工作所必需的,它只是确保svg与carat旁边的任何文本保持内联。我使用margin-bottom将它与文本垂直居中,可能还有另一种方法。这是我在我的博客的侧导航(减去js)所做的。如果旁边没有文本,就不需要span或margin-bottom offset。

<div id="ID"></div>

<script type="text/javascript">
var x = document.getElementById('ID');

// your "margin-bottom" is the negative of 1/2 of the font size (in this example the font size is 16px)
// change the "stroke=" to whatever color your font is too
x.innerHTML = document.write = '<span><svg style="margin-bottom: -8px; height: 30px; width: 25px;" viewBox="0,0,100,50"><path fill="transparent" stroke-width="4" stroke="black" d="M20 10 L50 40 L80 10"/></svg></span>';
</script>

其他回答

你可以考虑使用字体Awesome,而不是使用unicode或其他图标

代码可以像(a)一样简单,包括字体很棒,例如<链接rel="样式表" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> (b)制作一个按钮,例如<button><i class="fa fa-arrow-down"></i></button>

你可以使用黑色三角形,Unicode值U+25b2和U+25bc。或者箭头,U+2191和U+2193。

˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅

˅˅˅Hǝɹǝsɐɯɐʇɔɥᴉuƃ年代ǝʇ˙˅˅˅ ˄˄˄这是一个匹配的集合。˄˄˄

˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄

“实际大小”:每人每个 (更多信息)


编辑:另一个选择…

⋁⋁⋁⋁⋁⋁⋁⋁⋁⋁Unicode # 8897 / U + 22 c1(“n - ary逻辑或“)

⋀⋀⋀⋀⋀⋀⋀⋀⋀⋀Unicode # 8896 / U + 22 c0(“n - ary逻辑和”)

实际尺寸:⋁⋀⋁⋀

上下颠倒的旋曲被称为caron或háček。

它在TADS Latin-2扩展到HTML中有一个HTML实体:&caron;看起来像这样:ˇ,不幸的是,它的大小/比例与^插入符号不同。

或者你可以使用unicode U+30C。

你能用document。write在span中绘制svg路径吗?span不是svg工作所必需的,它只是确保svg与carat旁边的任何文本保持内联。我使用margin-bottom将它与文本垂直居中,可能还有另一种方法。这是我在我的博客的侧导航(减去js)所做的。如果旁边没有文本,就不需要span或margin-bottom offset。

<div id="ID"></div>

<script type="text/javascript">
var x = document.getElementById('ID');

// your "margin-bottom" is the negative of 1/2 of the font size (in this example the font size is 16px)
// change the "stroke=" to whatever color your font is too
x.innerHTML = document.write = '<span><svg style="margin-bottom: -8px; height: 30px; width: 25px;" viewBox="0,0,100,50"><path fill="transparent" stroke-width="4" stroke="black" d="M20 10 L50 40 L80 10"/></svg></span>';
</script>