如何使用分拣机在XML视图中按日期对象进行分组?

时间:2022-06-06 16:53:39

I'm trying to group by date objects in my xml view. I have problems and hoping someone could give me a hand / explain what should / can I do?

我正在尝试在xml视图中按日期对象进行分组。我有问题,希望有人能帮助我/解释我应该做什么/我能做什么?

As of now what happens is:

到目前为止发生的事情是:

  1. My controller receive from odata.
  2. 我的控制器从odata收到。

  3. One of the field have data object that looks like DATE: "/Date(1430524800000)/"
  4. 其中一个字段的数据对象看起来像DATE:“/ Date(1430524800000)/”

I have tried sorter: { path: 'DATE', descending: false, group: true }, groupHeaderFactory:'.getGroupHeader' }

我尝试过分拣机:{路径:'DATE',降序:false,group:true},groupHeaderFactory:'。getGroupHeader'}

But it doesn't work.

但它不起作用。

What I want:

我想要的是:

  1. Group by weekly or monthly view on the xml.
  2. 按xml上的每周或每月视图分组。

Many thanks in advance.

提前谢谢了。

1 个解决方案

#1


0  

In here you can have a look at a very simple example for a sorter: https://openui5beta.hana.ondemand.com/#docs/guide/c4b2a32bb72f483faa173e890e48d812.html.

在这里,您可以查看分拣机的一个非常简单的示例:https://openui5beta.hana.ondemand.com/#docs/guide/c4b2a32bb72f483faa173e890e48d812.html。

If your sorter works which means that the binding is fine then the sorting will should be working too. There is the example from the link

如果您的分拣机工作意味着绑定没问题,那么分拣也应该有效。链接中有一个例子

<mvc:View
controllerName="sap.ui.demo.wt.controller.InvoiceList"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc">
<List
        id="invoiceList"
        class="sapUiResponsiveMargin"
        width="auto"
        items="{
            path : 'invoice>/Invoices',
            sorter : {
                path : 'ShipperName',
                group : true
            }
        }">
    <headerToolbar>
        <Toolbar>
            <Title text="{i18n>invoiceListTitle}"/>
            <ToolbarSpacer/>
            <SearchField width="50%" search="onFilterInvoices"/>
        </Toolbar>
    </headerToolbar>
    <items>
        …
    </items>
</List>
</mvc:View>

#1


0  

In here you can have a look at a very simple example for a sorter: https://openui5beta.hana.ondemand.com/#docs/guide/c4b2a32bb72f483faa173e890e48d812.html.

在这里,您可以查看分拣机的一个非常简单的示例:https://openui5beta.hana.ondemand.com/#docs/guide/c4b2a32bb72f483faa173e890e48d812.html。

If your sorter works which means that the binding is fine then the sorting will should be working too. There is the example from the link

如果您的分拣机工作意味着绑定没问题,那么分拣也应该有效。链接中有一个例子

<mvc:View
controllerName="sap.ui.demo.wt.controller.InvoiceList"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc">
<List
        id="invoiceList"
        class="sapUiResponsiveMargin"
        width="auto"
        items="{
            path : 'invoice>/Invoices',
            sorter : {
                path : 'ShipperName',
                group : true
            }
        }">
    <headerToolbar>
        <Toolbar>
            <Title text="{i18n>invoiceListTitle}"/>
            <ToolbarSpacer/>
            <SearchField width="50%" search="onFilterInvoices"/>
        </Toolbar>
    </headerToolbar>
    <items>
        …
    </items>
</List>
</mvc:View>