Saturday, September 1, 2012

Allow Sorting

Fields automatically created by Code On Time generator have sorting enabled by default. However, if a calculated field is created by a developer, sorting must be explicitly allowed. Ability to sort may also be disabled on any field.

For example, the Employees grid view below has been configured to display a calculated field called Full Name. When you mouse over the Full Name column header, it is rendered as text and there is no dropdown available for filtering or sorting operations.

Sorting is not enabled for Full Name calculated field. The Full Name column header is not clickable and has no context menu.

Let’s allow sort operations on the field.

Start the Project Designer. In the Project Explorer, switch to the Controllers tab and double-click on Employees / Fields / FullName field node.

FullName field node in Code On Time web application Project Explorer.

Enable sorting.

Property New Value
Allow Sorting true

Press OK to save the field. On the toolbar, press Browse.

Navigate to the Employees page. Mouse over the Full Name header – it will be rendered as a link, and a dropdown menu will be available with sorting options.

FullName column header has sorting enabled and displays a context menu with sorting options.

Clicking on the column header text once will activate the first sorting option.

Full Name with A-Z sorting activated.

Clicking on the text again will activate the second option.

Full Name with Z-A sorting activated.

A sort can be deactivated by clicking on the sort option in the dropdown.

Largest on Top sorting option enabled for Full Name column.

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.


© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com