How to filter a table in an child frame

Hi Support

Our application uses a particular table throughout the application. We include the frame containing the table as a component in the parent screens.

Is it possible to filter the contents of the table with the generic filter component that lives in the parent screen?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        caption="Find Creatives"
        class="com.yieldmo.ymcuba.web.findcreatives.FindCreativesBrowse"
        focusComponent="creativesLookupTable">
    <dialogMode height="600"
                width="800"/>
    <layout expand="tablesContainer"
            margin="false,true,false,true"
            spacing="true">
       <!-- THE FILTER -->
        <filter id="findCreativesFilter"/>

      <vbox id="tablesBox"
                  height="100%">
               <!-- THE TABLE IS INSIDE THIS SCREEN -->
                <frame id="creativesLookupTable"
                       height="800px"
                       screen="managedServiceCreativesLookupTable"/>
            </vbox>
    </layout>
</window>

HERE IS THE XML FOR THE FRAME

<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        class="com.yieldmo.ymcuba.web.findcreatives.ManagedServiceCreativesLookupTable"
        focusComponent="reportCreativeTable"
        lookupComponent="reportCreativeTable"
        messagesPack="com.yieldmo.ymcuba.web.findcreatives">
    <dsContext>
        <collectionDatasource id="creativesDs"
                              allowCommit="false"
                              class="com.yieldmo.ymcuba.entity.Creative"
                              maxResults="200"
                              view="creative-manager-creative-with-campaign">
            <query>
                <![CDATA[select e from ymcuba$Creative e
where e.adBuilderCreativeId is not null
and e.status <> 'deleted'
and e.id not in (select r.programmaticPostcardCreative.id from ymcuba$RtbBidder r)
and e.id not in (select cf.previewCreative.id from ymcuba$CreativeFormat cf)
order by e.createTime desc]]>
            </query>
        </collectionDatasource>
        <collectionDatasource id="creativesReportingDs"
                              allowCommit="false"
                              class="com.yieldmo.ymcuba.entity.BasicInsightReportCreative"/>
        <collectionDatasource id="creativeFormatsDs"
                              allowCommit="false"
                              class="com.yieldmo.ymcuba.entity.adbuilder.CreativeFormat">
            <query>
                <![CDATA[select e from ymcuba$CreativeFormat e
where e.status = 'active'
order by e.name]]>
            </query>
        </collectionDatasource>
    </dsContext>
    <dialogMode height="600"
                width="800"/>
    <layout>
        <table id="reportCreativeTable"
               contextMenuEnabled="false"
               height="100%"
               multiLineCells="true"
               multiselect="true"
               responsive="true"
               stylename="detailsTable"
               width="100%">
            <actions>
                <action id="edit"
                        invoke="handleEdit"
                        openType="NEW_TAB"/>
                <action id="openProgrammaticTags"
                        invoke="onOpenProgrammaticTagsButtonClick"
                        trackSelection="true"/>
            </actions>
            <columns>
                <column id="name"
                        width="284"/>
                <column id="adGroup.campaign.name"
                        caption="Campaign"/>
                <column id="programmaticTags"
                        caption="Programmatic Third Party Display Tags"
                        generator="generateProgrammaticTagsCell"/>
                <column id="mpsTags"
                        caption="MPS Tags"
                        generator="handleGenerateMpsTagCell"/>
                <column id="createTime"
                        caption="Date Created">
                    <formatter class="com.haulmont.cuba.gui.components.formatters.DateFormatter"
                               format="MM/dd/yyyy"/>
                </column>
                <column id="lastModified"
                        caption="Last Modified">
                    <formatter class="com.haulmont.cuba.gui.components.formatters.DateFormatter"
                               format="MM/dd/yyyy"/>
                </column>
                <column id="format"
                        caption="Format"
                        generator="generateFormatCell"/>
                <column id="createdByContact.name"
                        caption="Created By"
                        width="162"/>
                <column id="view"
                        caption="View"
                        generator="generateViewCell"/>
                <column id="duplicate"
                        caption="Duplicate"
                        generator="generateDuplicateCell"/>
                <column id="edit"
                        caption="Edit"
                        description="Only creatives which you have created may be edited."
                        generator="generateEditCell"/>
                <column id="impressions"/>
                <column id="ctr">
                    <formatter class="com.yieldmo.ymcuba.components.formatters.RateFormatter"/>
                </column>
                <column id="conversions"/>
                <column id="scrolls"
                        description="A Scroll is a user-initiated vertical change in direction of at least 5% of the ad height"/>
                <column id="scrollRate"
                        description="Total number of scrolled impressions / Total number of impressions. A Scroll is a user-initiated vertical change in direction of at least 5% of the ad height.">
                    <formatter class="com.yieldmo.ymcuba.components.formatters.RateFormatter"/>
                </column>
                <column id="swipes"/>
                <column id="swipeRate">
                    <formatter class="com.yieldmo.ymcuba.components.formatters.RateFormatter"/>
                </column>
                <column id="playImpressions"/>
                <column id="playRate">
                    <formatter class="com.yieldmo.ymcuba.components.formatters.RateFormatter"/>
                </column>
                <column id="playImpressionCompletions"/>
                <column id="playCompletionRate">
                    <formatter class="com.yieldmo.ymcuba.components.formatters.RateFormatter"/>
                </column>
            </columns>
            <rows datasource="creativesReportingDs"/>
            <rowsCount/>
        </table>
    </layout>
</window>

Hi Herby,

Unfortunately, it’s impossible in the current implementation. The filter must be defined in the same frame as the datasource it is connected to, otherwise filter parameters cannot be found by the datasource when it loads data.

Regards,
Konstantin

1 Like