• Does the DataView support any events?

    By Howard Greenberg 1 decade ago

    The View control has events (onclick, etc) for the columns.  Does the DataView support events like this?  Can you provide an example of the markup if it does?

     

    thanks,

     

    Howard

    • Use the facets for each column.

      By Maire Kehoe 1 decade ago

      There is no onclick property for each column. Instead to change the behavior of the columns, you'll need to provide your own facet controls that are rendered at each column location.

      For example, the tooltip description for the xe:dataView "extraColumns" property is:
      Define the extra columns to be rendered, if any. The values in the extra columns may be provided by this property, or as facet controls, using facet names xp:key="extra0", xp:key="extra1", etc. Any facet must have a corresponding column object in this "extraColumns" list, as the column determines the location where the facet will be displayed.

      Here is an example of using a facet control to supply the content of the 0th extra column. It is using a Label control to display the column value, and the onclick event will be triggered when the Label is clicked. This is modified from the Domino_DataView.xsp in the XPagesExt.nsf demo application.

          collapsibleRows="true" collapsibleDetail="true"
          pageName="/Domino_ViewStateForm.xsp" columnTitles="true"
          rowStyleClass="xspHtmlTrView" rows="10" indexVar="rowIndex"
          partialExecute="true" partialRefresh="true">
         
                          viewName="AllThreads" expandLevel="1">
             

         

         
                          columnTitle="Title">
             

         

         
                          columnTitle="Date">
             

                          columnTitle="Author">
                 
             

         

         
             
                 
                                          submit="false">
                         
                     

                 

             

             
                 
                                          formName="Discussion" action="editDocument"
                          documentId="#{javascript:viewEntry.getUniversalID()}">
                     

                 

                 
                     
                 

                 
                                  id="link3">
                 

                                  id="label1">
                 

             

         

      In that example, the summary column and the extraColumn named Author are configured as column complex-types. The extraColumn named Date is provided by both a xe:viewExtraColumn column complex-type, and also by the facet with xp:key="extra0". The xe:viewExtraColumn is providing the columnTitle, which appears as the colum header. The facet is supplying the content of the column, re-displayed in every row of the xe:dataView. The facet is responsible for actually displaying the column data, which it is doing using a Label control. The onclick xp:eventHandler can then be added to the Label control, so that when you click on any of the Date labels, an alert dialog will appear.

      You can also provide your own facets for other columns. See the tooltip descriptions for the properties in the All Properties view to find the xp:key name corresponding to each column. For example the summaryColumn property supports a facet name of xp:key="summary".

      • *Thanks,it even worked in the moble controls

        By Howard Greenberg 1 decade ago