Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. <ul> //FeedListItems
  2. <li class="<MY_CUTOM_CLASS_1>"></li>
  3. <li class="<MY_CUTOM_CLASS_2>"></li>
  4. <li class="<MY_CUTOM_CLASS_3>"></li>
  5. </ul>
  6.  
  7. <FeedInput
  8. post="onPost"
  9. icon="test-resources/sap/m/images/dronning_victoria.jpg"
  10. class="sapUiSmallMarginTopBottom" />
  11. <List
  12. showSeparators="Inner"
  13. items="{/EntryCollection}" >
  14. <FeedListItem
  15. sender="{Author}"
  16. icon="{AuthorPicUrl}"
  17. senderPress="onSenderPress"
  18. iconPress="onIconPress"
  19. iconDensityAware="false"
  20. info="{Type}"
  21. timestamp="{Date}"
  22. text="{Text}" />
  23. </List>
  24.  
  25. sap.ui.define([
  26. 'jquery.sap.global',
  27. 'sap/m/MessageToast',
  28. 'sap/ui/core/format/DateFormat',
  29. 'sap/ui/core/mvc/Controller',
  30. 'sap/ui/model/json/JSONModel'
  31. ], function(jQuery, MessageToast, DateFormat, Controller, JSONModel) {
  32. "use strict";
  33.  
  34. var CController = Controller.extend("sap.m.sample.Feed.C", {
  35.  
  36. onInit: function () {
  37. // set mock model
  38. var sPath = jQuery.sap.getModulePath("sap.m.sample.Feed", "/feed.json")
  39. var oModel = new JSONModel(sPath);
  40. this.getView().setModel(oModel);
  41. },
  42.  
  43. onPost: function (oEvent) {
  44. var oFormat = DateFormat.getDateTimeInstance({style: "medium"});
  45. var oDate = new Date();
  46. var sDate = oFormat.format(oDate);
  47. // create new entry
  48. var sValue = oEvent.getParameter("value");
  49. var oEntry = {
  50. Author : "Alexandrina Victoria",
  51. AuthorPicUrl : "http://upload.wikimedia.org/wikipedia/commons/a/aa/Dronning_victoria.jpg",
  52. Type : "Reply",
  53. Date : "" + sDate,
  54. Text : sValue
  55. };
  56.  
  57. // update model
  58. var oModel = this.getView().getModel();
  59. var aEntries = oModel.getData().EntryCollection;
  60. aEntries.unshift(oEntry);
  61. oModel.setData({
  62. EntryCollection : aEntries
  63. });
  64. } });
  65.  
  66.  
  67. return CController;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement