UIControllerSortOnIncrementalSearch Property

Gets or sets the value determining if when the user uses the incremental search, the OrderBy will change to match to column the user is searching on.

Definition

Namespace: Firefly.Box
Assembly: Firefly.Box (in Firefly.Box.dll) Version: debug-master-v:33791
C#
public bool SortOnIncrementalSearch { get; set; }

Property Value

Boolean

Remarks

If set to true, when the uses starts the incremental search, the UIController will search for the first Sort in the Indexes property collection of the entity set in the From property, that start with the Column the user searches on. If such a Sort was found, the OrderBy property will be set by it.

Example

Sort on incremental search
This example is based on test data. The code for the entities included in this test data can be found in the documentation of Entity
This example uses automatic tools to generate parts of the user interface. Those tools can be found in the example of the documentation of Form
C#
using Firefly.Box;

namespace TestFirefly.Box.Documentation
{
    public class SortOnIncrementalSearch
    {
        public void Run()
        {
            var employees = new Pubs.Employees();
            employees.InitializeWithTestData();

            var uic = new UIController()
            {
                From = employees,
                Activity = Activities.Browse,
                AllowIncrementalSearch = true, //The Default
                SortOnIncrementalSearch = true,//The Default
                View = UITools.GenerateFormWithGridFor("Sort On Incremental Search",
                                                       "Park on the \"Last Name\" column, and start typing a name, you'll see that \n"+
                                                       "the list is now ordered by Last Name.\n"+
                                                       "Try the same on \"First Name\", you'll see that the order changes.\n"+
                                                       "Now try Searching the ID Column, you'll see that the order by doesn't \n"+
                                                       "change, because there is no entry in the indexes collection of the \n"+
                                                       "employees entity that starts with the ID Column. ",
                                                       employees.Id,
                                                       employees.LastName,
                                                       employees.MiddleInitial,
                                                       employees.FirstName)
            };

            employees.Indexes.Add(new Sort(employees.LastName));

            employees.Indexes.Add(new Sort(employees.FirstName));


            uic.Run();
        }
    }
}

See Also