在网格中排序记录 [英] ordering records in a grid

查看:85
本文介绍了在网格中排序记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张桌子可以安排人们进行试镜。  当表演者请求试镜时,他们会被放入"桶"中。他们试镜的时间。  我希望节目的制作人能够根据需要重新排序人物试听时段。

I have a table for scheduling people into slots in for auditions.  As performers request auditions, they are dropped into "buckets" of time for their audition.  I want the producer of the show to be able to re-order peoples audition slots as needed.

我在试听时段表上放了一个"订单"栏。  如何将每个试镜添加到插槽中,使此值单调增加(我可以执行一个on-save处理程序并将值分配给试听插槽的数量吗?)。  如何重新订购
行。  最理想的是,我想要一种拖拽LS网格中的行的方法,但如果我按箭头按钮,我会用'箭头'按钮进行上移/下移,如何访问上一行的"订单"列,以便交换价值?

I have put an 'order' column on my audition slot table.  How do I make this value monotonically increase with each auditioner added to the slot (could I do an on-save handler and assign the value to the count of audition slots?).   How do I re-order the rows.  Optimally, I'd like a way to drag-n-drop the rows in the LS grid, but I'll put up with 'arrow' buttons for move-up/move-down -- if I do the arrow buttons, how do I get access to the previous row's 'order' column so that the values can be swapped?

这样的事情:

 


public partial class AuditionSlot {
    partial void AuditionSlot_Created()
    {
        int windowId = this.AuditionWindow.Id;
    this.order = AuditionSlots.Count( w => w.AuditionWindow.Id == windowId );
    }
}

推荐答案

可能有一些方法可以做到。但我可能会这样做。

Probably a few way to do it. But I would probably do this.

设置表格如下:

Person => AuditionSlots< = Audition

Person => AuditionSlots <= Audition

- 人是注册期间添加的人。不关心订单。

- Person is the people added during signup. Don't care about order yet.

- 试镜是试镜表(即Aud1,Aud2等)。可能有姓名和日期。

- Audition is table of Auditions (i.e. Aud1, Aud2, etc). Probably has Name and Date.

- AuditionSlots是一个支持多对多的联结表。人们可以做很多试镜。试镜可以有很多人。 SlotNumber是行为1-N的顺序。它被添加到Unique索引中,就像Audition一样。因此,每个试镜都可以从1开始拥有自己的订单号

- AuditionSlots is a junction table to support the many-to-many. People can do many auditions. Auditions can have many people. SlotNumber is the order of the acts 1-N. It is added to Unique index as is Audition. So each audition can have its own order numbers starting from 1.


  • ID(键)
  • SlotNumber(int) 。包含在唯一索引中。
  • 法案(字符串)。什么人在做什么舞蹈,玩杂耍等。
  • 人际关系。人员记录的链接。
  • 试演关系。试听的链接。独特索引中的Inclue。

- 创建人员屏幕并添加人员。

- Create a Person screen and add people.

- 创建试听屏幕并包括试听详情和试听AuditionSlotsCollection。在右侧,您将看到试镜的名称和插槽的集合。  首先是Slot Number列。您可以更改插槽号,DB将强制执行
唯一性。  您还应该看到一个下拉列,以选择Person for slot。因此,您不需要真正精巧的插槽选择器scrren,因为更容易对插槽进行编号并对该列进行排序。您可以添加一个按钮来交换用户订单。 Grad选择项目
并提示目的地订单。代码可以交换它们。  点击订单更改后点击保存。  以下是我博客上的快速示例。

- Create a Audition screen and include Audition Details and Audition AuditionSlotsCollection. On the right side, you will see name of audition and a collection of Slots.  A Slot Number column is first. You can change slot numbers and the DB will enforce uniqueness.  You should also see a dropdown column to pick Person for slot. So you do not need a real fancy slot picker scrren as it is easier to just number the slots and sort that column. You could add a button to swap user order. Grad selected item and prompt for destination order. The code can swap them.  Click Save after order changes.  Here is quick sample on my blog.

http://staceyw1.wordpress.com/2011/07/12/lightswitch-and-slot-number-order-for-auditions -sample /

 

 


这篇关于在网格中排序记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆