Skip to Content
avatar image
Former Member

Unable to bind TableSelectDialog . Getting empty table .

novalue.jpg
onpressTableDialogfunction : function()

{
 	var sSelectedItemText = this.byId("POInput").getValue();
 	
 	 var oTableSelectDialog4 = new sap.m.TableSelectDialog( {
			title: "Inbound Delivery Details",
	
		
			multiSelect : true,
		
			columns : [
				new sap.m.Column({
					hAlign: "Begin",
					header: new sap.m.Label({
						text: "Inbound Delivery "
					})
				})
			
			], 
			items :
			[new sap.m.ColumnListItem({
					cells:[
					new sap.m.Text({
					text :"{InboundDelivery}"
				})
					]	
			})
							]
		});
		
		
		var sJson12 = {};
			var oModel1 = new sap.ui.model.json.JSONModel();
		this.oApplicationFacade.getApplicationModel("oData").read("GR4PO_DL_Headers('" + sSelectedItemText + "')/?$expand=Header2Items",
				null,
				null,
				false,
				function(oData, oResponse) {
						
sJson12.InboundDelivery = oData.Header2Items.results[0].InboundDelivery;
// Check header for backend system errors
var oHeader = oResponse.headers["sap-message"];
			if (oHeader) {
			var oJson = JSON.parse(oHeader);
				if (oJson.code) {
		sap.ca.ui.message.showMessageBox({
			type: sap.ca.ui.message.Type.INFO,
		message: decodeURIComponent(oJson.message)
						}, null);

					
						}
					}
				}
					);
	oModel1.setData(sJson12);
oTableSelectDialog4.setModel(oModel1);
 console.log(sJson12, "2200004784");
		       
  oTableSelectDialog4.open();
 
 	
 }
novalue.jpg (45.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 24, 2017 at 07:48 AM

    do read like this,

    var aFilters = [];
    //use your filter property(Itemname) and value (Item1)
    var oFilter = new sap.ui.model.Filter("ItemName", sap.ui.model.FilterOperator.EQ, "Item1"); 
    aFilters.push(oFilter);
    this.oApplicationFacade.getApplicationModel("oData").read("/GR4PO_DL_Headers", {
        filters : aFilters,
        urlParameters: {
            "$expand": "Header2Items"
        },
        null,
        null,
        false,
        function(oData, oResponse) {.............
    

    And, aggregation binding as below,

    var oTableSelectDialog4 = new sap.m.TableSelectDialog({
        title: "Inbound Delivery Details",
        multiSelect: true,
        columns: [
            new sap.m.Column({
                hAlign: "Begin",
                header: new sap.m.Label({
                    text: "Inbound Delivery "
                })
            })
        ]
    });
    
    var oTemplate = new sap.m.ColumnListItem({
    		cells:[new sap.m.Text({text:"{InboundDelivery}"})]
    
    });
    
    
    oTableSelectDialog4.setModel(oModel1);
    oTableSelectDialog4.bindItems("/results", oTemplate); //check your data if data inside "results", if not do "/" only
    
    Add comment
    10|10000 characters needed characters exceeded

  • May 23, 2017 at 03:52 PM

    Aggregation binding of 'items' is missing in your code

    check the explored app

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      since i have to pass a value while reading odata also it has $expand , how can i bind this with items aggegation .?

      .read("GR4PO_DL_Headers('" + sSelectedItemText + "')/?$expand=Header2Items"
      
      
      
  • avatar image
    Former Member
    May 25, 2017 at 07:07 AM

    yes it solved the issue . Thank you Akhilesh

    Add comment
    10|10000 characters needed characters exceeded