singleSelectionまたはmultipleSelection(tableSelection)の使用

注意: この手順では、このトピックの最後に記述されているインライン・データがUIXファイルに挿入されているものとして説明しています。demoTableDataというインライン・データでは、行と列のデータが提供されます。

singleSelectionまたはmultipleSelectionコンポーネントを挿入するには、次のようにします。

  1. 対象ファイルの設計構造ウィンドウで、行選択コンポーネントを挿入する「table」ノードまたは「hGrid」ノードを展開して、名前付きの子「tableSelection」ノードを探します。
  2. 「tableSelection」ノードを右クリックし、「tableSelectionの中に挿入」->「singleSelection」または「tableSelectionの中に挿入」->「multipleSelection」を選択します。
  3. プロパティ・インスペクタで、挿入した行選択コンポーネントの属性を設定します。

    注意: データ・バインディングを使用する場合には、「コンポーネントの属性のデータ・バインディング」を参照してください。

  4. コントロール・バーにコンポーネントを追加するには、次のようにします。
    1. 設計構造ウィンドウで、「singleSelection」または「multipleSelection」を右クリックし、「singleSelectionの中に挿入」->「submitButton」を選択するか、「multipleSelectionの中に挿入」->「submitButton」を選択して、指定コンポーネントを挿入します。UIXコンポーネントを選択すると、他のコンポーネントを挿入することもできます。
    2. プロパティ・インスペクタで挿入したコンポーネントの属性を設定します。

注意: 単一選択モードまたは複数選択モードで表を使用しているときには、それぞれ、TableProxyのgetSelectedRow()メソッドを使用して現在選択されている行の索引を取得し、getSelectedRows()メソッドを使用すると選択した行の複数の索引を取得できます。tableコンポーネントのプロキシ属性をtrueに設定する必要があります。詳細は、「tableProxyについて」を参照してください。

例(UIX XML)


...
<provider>
  <data name="demoTableData">
    <inline>
      <!-- data for 4 rows -->
      <demoRowData firstColumnText="First row"
                   secondColumnText="First Button"
                   thirdColumnText="First col"
                   fourthColumnText="111"
                   isSelected="false"
                   isDisabled="true" />
      <demoRowData firstColumnText="Second row"
                   secondColumnText="Second Button"
                   thirdColumnText="Second col"
                   fourthColumnText="222"
                   isSelected="true" />
      <demoRowData firstColumnText="Third row"
                   secondColumnText="Third Button"
                   thirdColumnText="Third col"
                   fourthColumnText="333"
                   isSelected="false" />
      <demoRowData firstColumnText="4th row"
                   secondColumnText="4th Button"
                   thirdColumnText="4th row col"
                   fourthColumnText="444"
                   isSelected="false" />
      <!-- data for the row headers -->
      <demoRowHeaderData headerText="1"/>
      <demoRowHeaderData headerText="2"/>
      <demoRowHeaderData headerText="3"/>
      <demoRowHeaderData headerText="4"/>
      <!-- data for the 4 column headers -->
      <demoColHeaderData textKey="H1"/>
      <demoColHeaderData textKey="H2"/>
      <demoColHeaderData textKey="H3"/>
      <demoColHeaderData textKey="H4"/>
      <!-- formatting information for the rows -->
      <demoRowFormats/>
      <demoRowFormats displayGrid="false"/>
      <demoRowFormats/>
      <demoRowFormats/>
    </inline>
  </data>
</provider>
...
<contents>
  ...
  <table id=tab1
         alternateText="No Items Found."
         blockSize="25"
         tableData="${uix.data.demoTableData.demoRowData}"
         columnHeaderData="${uix.data.demoTableData.demoColHeaderData}"
         rowHeaderData="${uix.data.demoTableData.demoRowHeaderData}">
    <tableSelection>
      <!-- SingleSelection. selected takes precedence over selectedIndex. disabled attr is bound -->
      <singleSelection selectedIndex="3"
                       text="Select an item and ..."
                       selected="${uix.current.isSelected}"
                       disabled="${uix.current.isDisabled}">
        <contents>
          <submitButton text="Copy"/>
        </contents>
      </singleSelection>
    </tableSelection>
    ...
  </table>
  ...
  <table id=tab2
         alternateText="No Items Found."
         blockSize="25"
         tableData="${uix.data.demoTableData.demoRowData}"
         columnHeaderData="${uix.data.demoTableData.demoColHeaderData}"
         rowHeaderData="${uix.data.demoTableData.demoRowHeaderData}">
    <tableSelection>
      <!-- MultipleSelection, using selected. disabled attr is bound -->
      <multipleSelection text="Select one or more rows to ..."
                         selected="${uix.current.isSelected}"
                         disabled="${uix.current.isDisabled}">
        <contents>
          <submitButton text="Delete"/>
        </contents>
      </multipleSelection>
    </tableSelection>
    ...
  </table>
  ...
  <table id=tab3
         alternateText="No Items Found."
         blockSize="25"
         tableData="${uix.data.demoTableData.demoRowData}"
         columnHeaderData="${uix.data.demoTableData.demoColHeaderData}"
         rowHeaderData="${uix.data.demoTableData.demoRowHeaderData}">
    <tableSelection>
      <!--multiselect using selection-->
      <multipleSelection text="Select one or more rows to ..."
                         selected="${uix.current.isSelected}">
        <contents>
          <submitButton text="Delete"/>
        </contents>
        <selection>
          <row isSelected="false"/>
          <row isSelected="false"/>
          <row isSelected="true"/>
          <row isSelected="true"/>
        </selection>
      </multipleSelection>
    </tableSelection>
    ...
  </table>
  ...
</contents>
...    

singleSelectionおよびmultipleSelection(tableSelection)について

tableコンポーネントの使用

 

Copyright © 1997, 2004, Oracle. All rights reserved.