This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jul 19, 2011, 2:09 PM
5 Posts

Guidance: Data Table & checkboxes

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: checkbox binding
  • Replies: 2
Hi, let me outline this.
 
I've got an XPage that has a data table that is bound to a viewScope variable which contains an array of arrays. This viewScope variable is populated by running a SQL stored procedure with a sessionScope variable as parameter (and performing some manipulation of the JDBC results), all triggered in the afterPageLoad of the XPage. This has been in use and works fine.
 
However, I'm now adding another use that is similar; what I want to add is a checkbox for each row in the data table. The user should be able to check the rows he/she wants (or check all using some action), and then click an action that reads the checkboxes that are checked so that SSJS can use the corresponding data in the viewScope var to perform some back-end data manipulation.
 
What I'm struggling with is this: I thought I could add a checkbox control to the data table, bind it to a viewScope variable or something, then use those values (somehow) to identify the "rows" (of the viewScope var bound to the data table) that I need to operate on. But adding the binding makes the checkbox control disabled.
 
If I can't bind the checkbox and have it retain its editability (which I don't believe is the case, but if) perhaps I can leave it unbound and use client JS to set some hidden field value, and then my action can use that to operate??
 
Anyway, ideas are appreciated. I'll be trying a bunch of stuff in the meantime. Thanks. 
Jul 19, 2011, 4:11 PM
122 Posts
Re: Guidance: Data Table & checkboxes
Check out the NotesIn9, I think it's episode 25 which talks about selecting documents from a repeat control. http://notesin9.com/index.php/2011/04/01/notesin9-025-selecting-documents-from-a-repeat-control/
 
It's effectively the same technique you need for a data table. I also wrote a series on validation of checkboxes, which has the whole aspect of setting/unsetting properties in a scoped variable based on whether the checkbox is ticked or not. It was some time ago, but covers various version of XPages and may be of interest http://hermes.intec.co.uk/Intec/Blog.nsf/archive?openview&title=Validation%20Tutorial&type=cat&cat=Validation%20Tutorial.
 
If you need to set the checkbox to checked or not, you can just set the defaultChecked property to check against the scoped variable you set in the onClick. 
Jul 19, 2011, 4:11 PM
5 Posts
Re: Guidance: Data Table & checkboxes
 Great, thanks, Paul. I'll check all of this out this afternoon.

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal