Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9069

Re: 2 RowRepeaters in the same page - is this a bug?

$
0
0

Hi guys.

The lack of answers means that either I wrote too much ( ) or that this never happened to anyone else. I hope SAP follows up on this issue so this situation can be corrected.

 

 

In the meantime, for anyone that has the issue, I though about it and here are two possible workarounds so this doesn't happen.

 

 

1st workaround: Replace the second row-repeater with a table (if possible)

I tested it and it doesn't cause any duplication problems in the first row-repeater.

The problem is that the graphic proprierties of a table are a bit more limited than what a row-repeater is capable of.

 

 

2nd workaround: Create invisible elements in the second row-repeater

As I said previously, depending on the number of rows in the second row-repeater, the number of duplicated results changes.

I found that, when the number of row in the 2nd row-repeater matches the number of maximum visibile rows in the first row-repeater, it doesn't duplicate any results. (Remember, if max visible rows are 5, it duplicates 5-X rows, being X the number of rows in the 2nd row repeater). If you just make X go to 5, it duplicates 0 rows. So... you can populate your node with multiples of 5, even if some of them are not visible.

 

So, 1st step: Both row-repeaters must have the same max number of visible rows (lets say Y)

2nd step: Create a visiblity attribute in your node.

3rd step: fill the node with your data.

4th step: if node.size() > 0, calculate the number of missing elements until it becomes a multiple of Y.

5th step: create the elements until it reaches a multiple of Y with WDVisibility.NONE.

 

Aditional step: everytime your node changes, you're gonna have to delete the invisible rows and perforrm steps 4 and 5 again.

 

 

Code example (with visibile rows == 5)

 

   Integer remain = 5 - wdContext.nodeVnMyNode().size() % 5;

   remain = remain == 5 ? 0 : remain; // in this case size() is a multiple of 5;

 

   for(int i = 0; i < remain; i++){

 

        IVnMyNodeElement new = wdContext.nodeVnMyNode().createAndAddVnMyNodeElement();

        new.setVaVisibility(WDVisibility.NONE);

 

   }

 

To delete these rows:

 

     for(int i = 0; i<wdContext.nodeVnMyNode).size();i++){

        elemento = (IVnMyNodeElement) wdContext.nodeVnMyNode().getElementAt(i);

 

        if(elemento.getVaVisibility()!= null && elemento.getVaVisibility() == WDVisibility.NONE){

             wdContext.nodeVnMyNode().removeElementAt(i);

             i--;

 

         }

     }

 

 

I hope this is usefull.


Viewing all articles
Browse latest Browse all 9069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>