UIControllerReloadDataAfterSavingRow Property

Gets or sets the value determining if whenever a row is left, all the displays rows in the grid are reevaluated.

Definition

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

Property Value

Boolean

Remarks

Normally only the values from the current rows are evaluated on the grid. Use this property to make sure all the rows on the grid are reevaluated, bear in mind that there is a performance cost to it.
The same behavior can be achieved manually by raising the RefreshDisplayedDataCommand.

Example

reload displayed data
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 System.Windows.Forms;
using Firefly.Box;
using Firefly.Box.Data;

namespace TestFirefly.Box.Documentation
{
    class RefreshDisplayedDataDemo
    {
        public void Run()
        {
            var jobs = new Pubs.Jobs();
            jobs.InitializeWithTestData();

            var minLevelAddition = new NumberColumn("Min Level Addition", "5")
            {
                DefaultValue = 50
            };
            var minLevelPlusAddition = new NumberColumn("Min Level + Addition", "5");
            minLevelPlusAddition.BindValue(() => jobs.MinLevel + minLevelAddition);

            var uic = new UIController
            {
                From = jobs,
                View = UITools.GenerateFormWithGridFor("Refresh Displayed Data After Leave Row Demo",
                    "When the \"Min Level Addition\" value is changed, notice \n" +
                    "that the \"Min Level + Addition\" is reevaluated. \n" +
                    "When you navigate between rows, you'll see that the \"Min Level + Addition\" \n" +
                    "reevaluates for the rows you parked.\n" +
                    "Change the \"Refresh Displayed Data After Leave Row\" checkbox, and\n" +
                    "then change the \"Min Level Addition\", you'll see that when you leave \n" +
                    "a row, all the rows are refreshed.\n" +
                    "Note that the same behavior can be achieved by clicking the \"Refresh Displayed Data\"\n" +
                    "button.",

                                         jobs.Id,
                                         jobs.Description,
                                         jobs.MinLevel,
                                         minLevelPlusAddition)
            };

            uic.AddAllColumns();
            uic.Columns.Add(minLevelAddition, minLevelPlusAddition);

            var refreshDisplayedDataCheckbox = new CheckBox
            {
                Text = "Refresh Displayed Data After Leave Row",
                Width = 250,
                Checked = uic.ReloadDataAfterSavingRow
            };
            refreshDisplayedDataCheckbox.CheckedChanged +=
                (a, b) => uic.ReloadDataAfterSavingRow = refreshDisplayedDataCheckbox.Checked;

            var refreshDisplayedDataButton = new Button
            {
                Text = "Refresh Displayed Data",
                Width = 100
            };
            refreshDisplayedDataButton.Click += (a, b) => uic.Raise(Command.RefreshDisplayedData);


            UITools.AddControlsToForm(uic.View,
                refreshDisplayedDataCheckbox,
                new Label { Text = minLevelAddition.Caption, Width = 100 },
                new Firefly.Box.UI.TextBox
                {
                    Data = minLevelAddition,
                    Width = 50
                });
            UITools.AddControlsToForm(uic.View, refreshDisplayedDataButton);

            uic.Run();
        }
    }
}

See Also