Wednesday, June 1, 2011

Using Data Tables in XPages

It took me quite some time to understand the way controls inside a datatable get bound to the datasources. It was a kind of trick that we would use with repeat controls that helped me do this.

1.Create a view with a few sample documents as shown below.

2.Now create an XPage that anddrag and drop a control on to it as shown below. Ofcourse add the computed texts and lables as shown in the image with desired styles

3. Now add the sample view that was created earlier as the data source for this data table

4. In the properties pane of the Data table, mention the collection name as colName1 s shown in the image

5. Now go to the properties pane of the computed fields and in the value tab bind them to the view columns as displayed in the image.

6. Now save and preview your XPage. You must be seeing something similar to the following. Ofcourse depending on the style sheets that you apply

Hope this helps :)

2 comments:

  1. How can I do Inline editing of documents in the Data Table ?
    Please reply,

    Thanks,
    Pranesh

    ReplyDelete
  2. A possible way is to manipulate your grid's html using client side javascript and process it with help of a lotusscript agent employing dojo.xhrGet method. Hope that makes sense

    And I think it would be better not to your name could get displayed properly rather than 'unknown'. Hope that makes sense too :)

    ReplyDelete