首页 \ 问答 \ dhtmlxGrid如何选择值进行排序?(dhtmlxGrid How to select the value for sorting?)

dhtmlxGrid如何选择值进行排序?(dhtmlxGrid How to select the value for sorting?)

我一直在使用dhtmlxGrid中的过滤和排序( https://dhtmlx.com/docs/products/dhtmlxGrid/samples/08_filtering/01_pro_filter.html ),我有一个问题:我们可以将这个列与员工排序吗?名字由姓氏改变而不改变他们的写作方式?

例如:

我们有:

  1. 亚历克斯卡尔森

  2. 大卫爱德蒙

  3. 詹姆斯布莱特伍德

排序后我们希望按此顺序排列名称:

  1. 詹姆斯布莱特伍德

  2. 亚历克斯卡尔森

  3. 大卫爱德蒙

可能吗?


I've been playing with the filtering and sorting in dhtmlxGrid (https://dhtmlx.com/docs/products/dhtmlxGrid/samples/08_filtering/01_pro_filter.html) and I have a question: Can we sort the column with the employees' names by the last names without the changing the way they are written?

E.g.:

We have:

  1. Alex Calson

  2. David Edmond

  3. James Brightwood

And after sorting we want to have the names in this order:

  1. James Brightwood

  2. Alex Calson

  3. David Edmond

Is it possible?


原文:https://stackoverflow.com/questions/43786091
更新时间:2023-08-22 09:08

最满意答案

“做任何事的最快方式都不是要这样做。” - Cary Millsap, 优化Oracle性能

“一位设计师知道他已经实现了真正的优雅,而不是什么都没有剩下,但是什么时候什么都没有了。” - Antoine de Saint-Exupéry

更简单的实现有两个表和三个索引,两个独特。 更复杂的实现有三个表和五个索引,四个独特。 asso_countries_players.player_name上的索引( 应该是代理 asso_countries_players.player_name 如果玩家的名字发生变化,比如他们结婚或者合法地改变它,如Chad Ochocinco(nee Johnson)所做的那样,会发生什么?)也必须是唯一的,以执行0..1球员和国家之间关系的性质。

如果数据模型不需要关联实体,则将其消除。 将0..1关系或1..n关系转换为n..n关系通常很简单:

  1. 添加关联实体(除非关系本身具有属性,比如开始或结束日期,否则我会质疑需要替代关键字)
  2. 用现有数据填充关联实体
  3. 重新实现外键约束
  4. 删除子表中被取代的外键列。

"The fastest way to do anything is not to do it at all." -- Cary Millsap, Optimizing Oracle Performance.

"A designer knows he has achieved true elegance not when there is nothing left to add, but when there is nothing left to take away." -- Antoine de Saint-Exupéry

The simpler implementation has two tables and three indexes, two unique. The more complicated implementation has three tables and five indexes, four unique. The index on asso_countries_players.player_name (which should be a surrogate ID -- what happens if a player's name changes, like if they get married or legally change it, as Chad Ochocinco (nee Johnson) did?) must also be unique to enforce the 0..1 nature of the relationship between players and countries.

If the associative entity isn't required by the data model, then eliminate it. It's generally pretty trivial to transform a 0..1 relationship or 1..n relationship to an n..n relationship:

  1. Add associative entity (and I'd question the need for a surrogate key there unless the relationship itself had attributes, like a start or end date)
  2. Populate associative entity with existing data
  3. Reimplement the foreign key constraints
  4. Remove superseded foreign key column in child table.

相关问答

更多
  • 这个问题已经在Hibernate论坛上提出并得到解答: https : //forum.hibernate.org/viewtopic.php?t= 954178&highlight = unidirectional+null+foriegn+foreign+ key 。 这似乎不是一个DB设计的问题,更多的是Hibernate的功能之一。 This question has been asked and answered on the Hibernate forums: https://forum.hib ...
  • 右键单击关联箭头。 选择属性在“属性”面板中,将“子属性”更改为“False”。 Right click on the association arrow. Select Properties In the Properties panel, change Child Property to False.
  • 您的数据模型应具有互惠关系,以便在获取任何特定对象时,您可以立即访问所有相关对象。 在您的情况下,具有互惠关系的数据模型看起来像: City{ company<-->Company.city } Company{ city<-->City.company employees<-->>Employee.company } Employee{ company<<-->Company.employees } 因此,如果您有一个Employee对象,您可以找到self.comp ...
  • 您需要映射supervision_association_table,以便您可以创建与之关系。 我可能会在这里讨论一些事情,但似乎因为你在这里有多对多,你真的不能有Client.schedules - 如果我说Client.schedules.append(some_schedule),那么“监督”中的哪一行是它指向? 因此,下面的示例为那些加入每个SupervisorAssociation的Schedule集合的访问者提供了只读“汇总”访问器。 association_proxy扩展名用于在方便时隐藏Su ...
  • 如果我有以下DDL。 员工(男:N)到ParkingArea。 但是,约束只在链接表中保留一个Employee,因此为1:N。 - START TSQL Use OrganizationReverseDB GO SET NOCOUNT ON IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[EmployeeParkingAreaLink]') and OBJECTPROPERTY(id, N'IsUserTab ...
  • “做任何事的最快方式都不是要这样做。” - Cary Millsap, 优化Oracle性能 。 “一位设计师知道他已经实现了真正的优雅,而不是什么都没有剩下,但是什么时候什么都没有了。” - Antoine de Saint-Exupéry 更简单的实现有两个表和三个索引,两个独特。 更复杂的实现有三个表和五个索引,四个独特。 asso_countries_players.player_name上的索引( 应该是代理 asso_countries_players.player_name 如果玩家的名字发生 ...
  • 对于一对多关系,您不需要查找表,此关系的“多”表中的外键列就足够了。 一对多和多对一关系在结构上是相同的,只是彼此的镜像。 所以你可能会说博客文章及其评论是一对多的关系(外键是“很多”,在这种情况下是“评论”)。 或者你可以说评论和他们的博客帖子是多对一的关系(同样,外键是“很多”)。 无论哪种方式,db结构都是相同的,没有查找表,并且“many”上的外键列。 You don't need a lookup table for one-to-many relationships, a foreign key ...
  • 您需要设置存储引擎...将您的查询更改为... CREATE TABLE Orders ( OrderId INT NOT NULL AUTO_INCREMENT, Date DATE NOT NULL, Quantity INT NOT NULL, TotalDue FLOAT NOT NULL, CustomerId INT NOT NULL, PRIMARY KEY(OrderId), FOREIGN KEY(CustomerId) REFERE ...
  • 如果城市的密钥是(country_id,city_id),那么关系是“识别” - 意味着主键部分或全部是对另一个表的外键引用。 如果country_id不是主键的一部分,那么它是非标识的。 这两个不同的键会使表格在每种情况下代表非常不同的东西,但只有你可以说哪个更适合你的要求。 不要过分担心识别与非识别关系的概念。 这是一个源于ER建模的概念,但在关系数据库设计中,它通常具有很小的实际意义。 If the key of cities is (country_id, city_id) then the rel ...
  • 您可以使用.with_parent构造lazy="dynamic"所做的相同查询。 class Parent(Base): ... @property def children_dynamic(self): return object_session(self).query(Child).with_parent(self, Parent.children) 如果你必须编写很多这些函数,你甚至可以添加一个函数来减少样板: def dynamicize(rel): ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)