Strange Behaviour with Infragistics UltraGrid + Required Fields


Author
Message
Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
Hi,

I have a simple maintenance form with an UltraGrid (2008 Vol 2) bound to a BBS with a 2 field BO. I set RequiredFields on both fields and when I add a new record to the grid and populate both fields, a save reports that there is a broken rule. On further examination the broken rule reports a value is required for the last field entered. I can see the value in the grid but accessing the field directly from the BO shows it as empty during the save.

If I remove the Required Fields check then I am able to add and save new records.

The following sequence hightlights the problem:-

1. Click the New button to add a new row.

2. Click the first cell, enter a value.

3. Tab into the second cell and enter a value but do not leave the cell. This is the cause of the problem.

4. Click on the form save. The UltraGrid is still in editing mode so the active cell hasn't updated the BO which means it fails the Required Fields check as the BO believes the field to be empty.

I have tried to exit edit mode on the grid but there doesn't appear to be an event that will allow this before the Required Fields check has cached the blank value. I have tried the BeforeSave on the form and CheckRulesOnCurrentRow on the BO. While the grid does exit edit mode and I can see the BO field has been updated correctly in both of these events, it looks like the Required Fields check has already cached the original blank value before these events are fired as the check continues to report the broken rule.

Has anyone encountered this problem and found a way around it?

Thanks in advance.

Aaron

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Aaron,

I missed this post, sorry Blush  Could you post a quick sample using the StrataFrameSample database to show your problem.  It may be easier to go down that path versus bantering back and forth and not really getting to the source of the behavior.  Thanks. Smile

Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
Hi Trent,

No problem about the delay - that is still fast based on my previous framework standards!

I have attached a one BO and one form project that works with your Products table. The UltraGrid is 2008 vol 2. I have made all visible fields a "required field". To see the problem do this:-

1. Run the form.

2. Click Edit and click on the first record.

3. Click or tab into the empty product description column and type something in. Please note that you should NOT leave the cell. With the cursor still in the description cell containing your new text, click on the Save button. You will be told you have a broken rule which is the framework believing the description cell is empty when that is incorrect.

The basic problem is the grid is still in edit mode. I have tried using the BO events to intercept the save and make the grid exit edit mode. However, it looks like the framework caches the field value at a very early stage and doesn't see that the field is updated when the grid changes mode during the BO events.

I have come up with a workaround by adding the following handler to the toolbar click event:-

        private void MaintenanceFormToolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            // The grid must exit edit mode to ensure the current cell is handled properly for a save or undo
            if (e.ClickedItem.ToString() == "Save" || e.ClickedItem.ToString() == "Undo")
                Grid.PerformAction(UltraGridAction.ExitEditMode);
        }

I haven't fully tested this and it is possible I still have to deactivate the current cell before issuing the Grid.PerformAction. It also will not work when the user closes the form and is asked to save.

While the above can be made to work, I think it would be better if the framework didn't cache the field so soon to allow a more graceful solution during the BO save events. While it is possible to exit edit more on the grid in the BeforeSave or CheckRulesOnCurrentRow events and the BO field property is correctly updated, it is too late for the required fields check. Even though the check is still to occur, the blank value has been already cached and this is used instead of the current field value in the BO at the point the check is run.

Thanks

Aaron


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Aaron, this may be something that we have to add to a "to-look-at" list as we do not have the latest version of INfragistics loaded and are trying to get the 1.6.6 build out.  We will probably update to the latest prior to the 1.6.6 release (which will be in July prior to the training class).  I know that you don't want to wait that long, so I will see if I can load it on a VM or something within the next week and take a look.  As I mentioned on the other post regarding the grid, you are welcome to post a sample (which you aluded to in your post but I did not see the attachment).  This will definitely speed things up!
Aaron Young
Aaron Young
StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)StrataFrame User (435 reputation)
Group: StrataFrame Users
Posts: 277, Visits: 1.1K
I am happy for you to leave this to another time. I have a workaround so I can move past this one now.

On a separate note, do you know yet if the multiple relations per business object will be available in the next build?

Aaron

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
On a separate note, do you know yet if the multiple relations per business object will be available in the next build?

This is the one bigger thing that I have on my list to include (hopefully) in the 1.6.6 build.  So the odds are looking good for it Wink

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search