Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Data binding to grouped list in XML view

$
0
0

Hello

 

I have been struggling for many days to try to get the data binding to a grouped list for an XML view to work. It works fine if I use a JS based view but I really would like to get this working via XML views. I have read through the documents relating to aggregation and data bindings but could not figure out what is wrong with my code.

 

The problem I am facing is that if I use the following code, I get no data when running the app:

 

<List

    items="{

  

    path: '/data'

  

    }">

<StandardListItem

      title="{level}"

      description="{description}"

      type="Navigation"

  />

 

notworking.PNG

 

If I just use the below I can see the data.

 

<List items="{/data"}">

<StandardListItem

      title="{level}"

      description="{description}"

      type="Navigation"

  />

</List>

 

working.PNG

 

The problem with the code in green is that I will not be able to group the items. I am looking to group this based on the levels i.e. "Separate according to "Warnings" and "Error".

 

Here is my project Structure:

 

projstruct.PNG

 

 

Here is my view controller:

 

viewcont.PNG

 

Here is my view

 

view.PNG

 

Here is my JSON structure in a file

 

{

    "data": [

        {

            "index": 0,

            "level": "Warning",

            "description": "HALI: I'm sorry, Dave. I'm afraid I can't do that."

        },

        {

            "index": 1,

            "level": "Warning",

            "description": "Windows Boot Manager has encountered a problem."

        },

        {

            "index": 2,

            "level": "Error",

            "description": "Failwhale: Twitter is over capacity"

        },

        {

            "index": 3,

            "level": "Success",

            "description": "Jun 25 12:20:47 pc1h kernel: lp0 on fire"

        },

        {

            "index": 4,

            "level": "Error",

            "description": "Software failure. Press left mouse button to continue. Guru Meditation #00000004,#0000AACB."

        },

        {

            "index": 5,

            "level": "Error",

            "description": "[root@localhost root]# Kernel Panic"

        },

        {

            "index": 6,

            "level": "Error",

            "description": "That does not compute."

        },

        {

            "index": 7,

            "level": "Warning",

            "description": "404 File not found. Stop messing with the URL."

        },

        {

            "index": 8,

            "level": "Success",

            "description": "Blue Screen of Death."

        }

    ]

}

 

Here is my index.html file

 

index.PNG

 

Any help would be greatly appreciated.

 

Thanks in advance,

Regards,

Thashin


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>