Developer forum

Forum » Integration » RibbonBarAddIn returning wrong rows

RibbonBarAddIn returning wrong rows

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I am using the RibbonBarAddIn from the integration project to send orders to AX. However, it seems that the addin has access to the wrong rows. When I apply sorting and filtering, then the rows array in Load and the rows in TransferOrdersButton_Click don't represent the rows I see on screen. This in turn means that the check for the IntegrationOrderID fails and the UI pops up an alert that all the rows were transferred previously. When I skip that alert in code and always let the button run TransferOrdersButton_Click then the code can't find orders without an IntegrationOrderID even though I selected a number of orders without said ID in the UI. When I select one of the orders individually, the transfer works fine.

It seems that the orders[] from the ribbon doesn't match the orders you see on screen. I am not sure what it is though; could be the orders before sorting or before filtering.

Anyone any ideas? Seen this before? Happy to supply more information if needed.

Imar


Replies

 
Dmitriy Benyuk
Reply

Hi Imar,

the code which gets the selected orders from the list when the TransferOrdersButton was clicked is here:

//Get selected orders from order list - returns all rows in the list
                Dynamicweb.Controls.ListRowCollection rows = HttpContext.Current.Session["DW.Controls.Tree.List"] as Dynamicweb.Controls.ListRowCollection;
                if (rows != null && rows.Count > 0 && rows.Any(r => r.Selected))
                {
....

//returns the selected rows

                   foreach (string id in rows.Where(r => r.Selected).Select(r => r.ItemID).Distinct())
                    {

So this loop should match the selected orders from the screen with filters.

And you are right about Load()
Order[] orders = base.Ribbon.DataContext.DataSource as Order[];
this returns all orders from the current page, and the problem is that the filtering is applied at OrdersList_PreRender event which runs after Load event and the orders are returned not filtered. This looks like a bug

Regards, Dmitrij

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Dmitrij,

Thanks for finding the issue in Load. That makes sense. Is this a bug in the sample code (and thus something I can easily change myself) or a bug in the RibbonBar?

Also, I am not sure if TransferOrdersButton behaves correctly. Check out this video: http://screencast.com/t/uAev4PeP5

0:00: Showing orders, uses previously set filters.
0:16: Clicking Transfer to AX for three orders that already have an integration ID.
0:24: Shows that there are 25 rows (the current page size) which is correct
0:31: Shows that there are 3 selected rows
0:52: Sorting orders so those without an integration order ID show at the top.
1:23: Screen reloads and preselects the first few rows.
1:28: We now have 75 rows, instead of 25
1:40: We now have 6 selected rows, instead of three.

It seems that the previous selection is maintained as well.

If I page to, say, page 2, and then back and click Transfer again, I now have 125 rows in the rows variable and 11 selected items.  If I make more filter changes and page a few times, I get 221 rows with 21 selected ;-)

Any thoughts on this? Let me know if you need more information to reproduce this.

Imar

 
Dmitriy Benyuk
Reply

Hi Imar,
this is a bug and is already fixed in TFS#22511. Willl be ready after QA checking and release/hotfix.
Regards, Dmitrij

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Great, thanks. Will this be fixed in 8.7 as well? Or 8.8 only?

Imar

 
Dmitriy Benyuk
Reply

Hi Imar, yes

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Great, thank you.

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Dmitriy,

Any news on this? Has this been included in a release that is out? I checked the release notes but see no mention of this bug number.

Thanks,

Imar

 
Dmitriy Benyuk
Reply

Hi Imar,
it is in 8.7.2.14 which is now available to download.
Regards, Dmitrij
 

 

You must be logged in to post in the forum