padibro
padibro

Reputation: 1374

Selection checkboxes not shown in the table

I have seen this example of Table https://openui5.hana.ondemand.com/explored.html#/sample/sap.ui.table.sample.Basic/preview

In the example on the left of each row I have a checkbox to select the row. In the my implementation don't see the ceckboxes: enter image description here

This is the code (a table in a wizardstep into a wizard inside a dialog):

<WizardStep id='stepImballo' title="Formato imballo" icon="sap-icon://customer-view"
                        complete="wizardStepCompletedHandler">

                <t:Table
                        rows="{model>/formatoImballoColore/}"
                        selectionMode="MultiToggle"
                        visibleRowCount="6">
                    <t:columns>
                        <t:Column>
                            <m:Label text="Formato"/>
                            <t:template>
                                <m:Text text="{model>formato/description}"/>
                            </t:template>
                        </t:Column>
                        <t:Column>
                            <m:Label text="Peso (kg)"/>
                            <t:template>
                                <Input value="pluto"></Input>
                            </t:template>
                        </t:Column>
                        <t:Column>
                            <m:Label text="Articolo latta"/>
                            <t:template>
                                <Input value="pluto"></Input>
                            </t:template>
                        </t:Column>
                        <t:Column>
                            <m:Label text="Tara"/>
                            <t:template>
                                <Input value="pluto"></Input>
                            </t:template>
                        </t:Column>
                        <t:Column>
                            <m:Label text="Imballo"/>
                            <t:template>
                                <Input value="pluto"></Input>
                            </t:template>
                        </t:Column>
                        <t:Column>
                            <m:Label text="Quantità per UDC"/>
                            <t:template>
                                <Input value="pluto"></Input>
                            </t:template>
                        </t:Column>
                    </t:columns>
                </t:Table>


            </WizardStep>

On the top of my fragment I have the xml uses:

xmlns="sap.m"
xmlns:t="sap.ui.table"
xmlns:core="sap.ui.core"
xmlns:f="sap.ui.layout.form"
xmlns:l="sap.ui.layout"
xmlns:m="sap.m"

The problem seems to be the incorrect use of one of the component(use sap.ui in place of sap.m)

Upvotes: 1

Views: 5550

Answers (3)

Mudassir Hasan
Mudassir Hasan

Reputation: 28751

I faced the same hair splitting issue. Found that the checkboxes were not being rendered on older version of SAPUI5 library ( we were using version 1.28.39).

Found solution by adding class sapUiSizeCompact to container of table.

  <f:Form id="idSearchResultsFrm" maxContainerCols="4" editable="true"
            class="sapUiSizeCompact">

            <f:layout>
                <f:ResponsiveGridLayout />
            </f:layout>
            <f:formContainers>
                <f:FormContainer>
                    <f:formElements>
                        <f:FormElement>


                            <t:Table id="idSearchResultTable" visibleRowCount="5"
                                rows="{SearchResult>/}" selectionMode="MultiToggle">
                                <t:columns>

                                ...
                                ...
                                ...
                                </t:columns>
                            </t:table>

Upvotes: 0

rwur
rwur

Reputation: 247

You have to add the class sapUiSizeCozy to the body-tag inside your index.html

<body class="sapUiBody sapUiSizeCozy" role="application">
    <div id="content"></div>
</body>

This will set the checkboxes in the first column

Upvotes: 1

Sunil B N
Sunil B N

Reputation: 4225

use sap.m.Table instead of sap.ui.table.Table.

use mode property of ListBase(from which sap.m.Table is inherited) to handle selections.

Here selection mode:"MultiSelect" seems appropriate. For more types of modes read here.

In general, look for always parent control. All properties will be inherited to the child controls.

Upvotes: 1

Related Questions