Skip to main content

Background:  Two List Views exist on a Form bound using the same smartobject.  When the user clicks a row on View 1, javascript is triggered in View 2 to find row with same ID and then triggers the ListItem Click event of View 2.  This works well.

 

Problem:  Both views have paging enabled, so if user moves focus of View 1 to Next or Previous Page, the two views are now out of sync.  So the Javascript fails because the ID of row in View 1 is not to be found in View 2.

 

Question:  What technique can be used to keep View1 and View2 in sync if user clicks on the Next or Previous buttons  of a List View.  In other words, how can I execute the corresponding Next/Previos buttons in the other View, or how can I simulate the same results using rules on the view being clicked?  Is there any way to detect the event and respond to it?

 

 

 

 

I found an alternate solution which is much simpler. The reason I used Java Script to tap into View 2's list item click event  was because I was under the impression that I could unlink the many many rules contained in the click event rule, and that I would have to manually recreate them for the other view or create an unbound rule and enter each rule again.   I tried that once in a previous K2 version, and either it did not work at that time or I was still getting oriented to K2.

 

To resolve, I opened the LisView On Click event rule and changed the title.  Then I removed the first line defining that rule was for the click event.  Then I saved the rule making it an onbound rule that can now be called from the two views’ OnClick event.  That seems to do the trick.


That is a very interesting work around, thanks for sharing! I'm afraid I don't totally understand the solution though, what was the purpose of using the ListView On Click event and changing its title and binding? What was in that rule that you wanted to call from the other on click events that you couldn't have just written in a seperate unbound rule?


Reply