Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sapui5 TableSelect Dialog Model

Hi Team, I am not able to bind the model for the table select model. Please see the code below

i will get responce when user clicks and that esponce i am setting model to dialog:

opendialog : function(response){

  var oModel = new sap.ui.model.json.JSONModel();

  oModel.setData(response);

  if (! this._oDialog) {

  this._oDialog = sap.ui.xmlfragment("ven.app.view.Dialog", this);

  this._oDialog.setModel(oModel);

  }

  this.getView().addDependent(this._oDialog);

  this._oDialog.open();

  }

But i see no records found, even though there are records in response

this is fragment

<core:FragmentDefinition

  xmlns="sap.m"

  xmlns:core="sap.ui.core">

  <TableSelectDialog

  noDataText="No Products Found"

  title="Tax Codes"

  items="{'/results'}">

  <ColumnListItem>

  <cells>

  <Text text="{DocumentNo}" />

  <Text text="{TaxCode}" />

  </cells>

  </ColumnListItem>

  <columns>

  <Column width="12em">

  <header>

  <Text text="DocumentNo" />

  </header>

  </Column>

  <Column width="12em">

  <header>

  <Text text="TaxCode" />

  </header>

  </Column>

  </columns>

  </TableSelectDialog>

</core:FragmentDefinition>

Also i want to remove search option, but i dont see any way to remove that.

Thanks in advance

Tags:
Former Member
replied

Hi Praveen,

Here is the working code.Hope this helps you.

Table Select Dialog Fragment Definition

<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">

  <TableSelectDialog noDataText="No Employees Found" title="Select Employee"

items="{/value}">

  <columns>

  <Column>

  <Text text="Person ID" />

  </Column>

  <Column>

  <Text text="Age" />

  </Column>

  <Column>

  <Text text="Phone" />

  </Column>

  <Column>

  <Text text="City" />

  </Column>

  <Column>

  <Text text="Country" />

  </Column>

  </columns>

  <items>

  <ColumnListItem>

  <cells>

  <ObjectIdentifier title="{PersonID}" />

  <Text text="{Age}" />

  <Text text="{Phone}" />

  <Text text="{Address/City}" />

  <Text text="{Address/Country}" />

  </cells>

  </ColumnListItem>

  </items>

  </TableSelectDialog>

</core:FragmentDefinition>

Controller.js

  onInit: function() {

    var oModel = new sap.ui.model.json.JSONModel();

    oModel.loadData("http://services.odata.org/V3/OData/OData.svc/PersonDetails");   

   sap.ui.getCore().setModel(oModel);

},

onPress: function() {

      this._oDialog = sap.ui.xmlfragment("tableselectdialog.TableDialog", this);

       this._oDialog.open();

}

View.xml

<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"

  controllerName="tableselectdialog.TableSelectDialog"

xmlns:html="http://www.w3.org/1999/xhtml">

  <Page title="Title">

  <content>

  <Button press="onPress" text="Click here to open Table Select Dialog" />

  </content>

  </Page>

</core:View>

Thanks,

Naga

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question