Skip to Content
avatar image
Former Member

Need to show total task number in Inbox like previous UWL

Hi Gurus,

Custom inbox has been developed similar to BPM inbox using UI5 toolkit.

Here a new requirement is that, to display the total number of task in the box i.e., task count.

I have a piece of sample code to do this functionality , but one doubt in that code snippet is

var url = "/databinding/proxy/http/host:port/.........";

above mentioned line is that default one to get the count or what URL i am supposed to add in that.

Step by step docs or lonk also appreciated.

Thanks,

Ragav

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 08, 2015 at 07:06 AM

    You need to use $count to get the number of records from entityset (or collection) for e.g. http://services.odata.org/OData/OData.svc/Categories/$count

    Regards,

    Chandra

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 09, 2015 at 05:56 AM

    Hi gurus,

    I have written following piece of code in index.html... but desire output is not proper, please help out on this code ..

    var oLabel = new sap.ui.commons.Label({id : "inboxTaskCount"});

      var url = ""; // proper url has in placed here.

      var oModel = new sap.ui.model.odata.ODataModel(url, true);

      oModel.setCountSupported(false);

      //creating instance of inbox

      var inx = new sap.uiext.inbox.Inbox();

      inx.setHandleBindings(true);

      inx.setModel(oModel);

      inx.bindTaskTable("/TaskCollection");

      //Code to get the Task Count

      inx.attachODataRequestCompleted(function(oEvent){

      var label = sap.ui.getCore().byId("inboxTaskCount");

      label.setText("Task Count ( "+oEvent.mParameters.bindingLength+ " )");

      label.setDesign(sap.ui.commons.LabelDesign.Bold);

      });

      oLabel.placeAt('taskcountcontent');

      var oLabel1 = new sap.ui.commons.Label({id : "inboxTaskCount1"});

      var label1 = sap.ui.getCore().byId("inboxTaskCount1");

      label1.setText("Task Count (  )");

      oLabel1.placeAt('taskcountcontent1');

     

         </script>

           </head>

           <body class="sapUiBody" role="application">

            <div id="ajaxloader" style="display:none;"></div>

            <div id="taskcountcontent">Task Count : </div>

            <div id="taskcountcontent1">Task Count 1 : </div>

            <div id="content"></div>

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Ragav,

      I think both oEvent and oControlEvent are same and would give you the instance of the Event.

      oEvent.mParameters is referring to the attributes of the instance and getParameters would give the value of the attribute of the instance.

      Regards,

      Kedar