Skip to Content
author's profile photo Former Member
Former Member

Table mode based on two levels of model


I have a sap.m.Table control where I want to set the mode property dynamically using a formatter.

My view is bound to the parent entity('thesises') and the items are bound with a sub entity('attachments'). So attachments is a subentity of thesises.

I want to use a property of both entities to decide the mode.

I tried this way, but that doesn't work:

mode: {
                                                                                    parts : [ {
                                                                                        path : 'uploadAllowed'
                                                                                        path: 'attachments/attachmentType'
                                                                                    formatter : function(
                                                                                            changeAllowed, attachmentType) {
                                                                                        if (uploadAllowed && attachmentType == "varia") {
                                                                                            return "Delete";
                                                                                        } else {
                                                                                            return "None";


So the mode should be 'Delete' when 'changeAllowed is true and the attachmentTime is "varia" (on item level). If not, the mode should be "None"

Is there anyone who can help me?

Thanks! 😊


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 13, 2015 at 01:11 PM

    Your code looks fine. Did you check for the values getting passed within the formatter ?

    In the formatter, the argument passed is 'changeAllowed' but you're referring to 'uploadAllowed'. Is it just a typo here or even the same in your code ?

    And in the first place make sure you have the extended bindingSyntax - Complex enabled in the bootstrap script for this to prrocess.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 14, 2015 at 05:20 AM

    as Former Member said - Typo!!!

    uploadAllowed is indefined in that scope

    JS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type="application/jso…


    var aData = [

    {lastName: "Dente", sub : { propery : "value1"}},



    var oControl = new sap.ui.commons.TextView().bindProperty("text",

    {parts : [ {

    path : 'lastName'



    path: 'sub/propery'


    formatter : function( lastname, property) {

    return lastname + " --- " + property;



    works fine.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.