Binding Data from OfflineStore to List in XML view

Hi Experts,
I am developing an application using SAP WebIDE. While loading a page, I want to read some data from an offlineStore and show it in a listview.
Following is my code for xml view:
<sap.ui.core.mvc:View xmlns="sap.m" xmlns:sap.ui.core="sap.ui.core" xmlns:sap.ui.core.mvc="sap.ui.core.mvc" controllerName="com.arteria.view.CustomerList">
    <Page title="Customers" showNavButton="true">
   </Page>
</sap.ui.core.mvc:View>
And my js code is as follows:
onInit: function() {
  this.getView().addEventDelegate({
   onBeforeShow: function(evt) {
    sap.ui.getCore().byId("idCustomerList").getController().read();
read:function() {
                oList = new sap.m.List();
                oList.removeAllItems();
                var uri = window.localStorage.getItem("ApplicationEndpointURL");
                var user = window.localStorage.getItem("User");
                var password = window.localStorage.getItem("Password");
                var headers = { "X-SMP-APPCID" : window.localStorage.getItem("ApplicationConnectionId") };
                // Create OData model from URL
                var oModel = new sap.ui.model.odata.ODataModel(uri, true, user, password, headers);
                var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
                if (iOS) {
                    oModel = new sap.ui.model.odata.ODataModel(uri, true, user, password, headers);
                var oTemplate = new sap.m.StandardListItem({
                                                           title: "{CustomerNumber}", description: "{CustomerName}", tap:"handleProductListItemPress", type:"Navigation"    
                oList.setModel(oModel);
                oList.bindItems("/Customers", oTemplate, null, null);
                var custListPage = sap.ui.getCore().byId("idCustomerList");
                custListPage.addCustomData(oList);
   handleProductListItemPress: function(oEvent) {
        sap.ui.getCore().getEventBus().publish("nav", "to", {
            id : "idCustomerDetail",
            context: oEvent.getSource().getBindingContext()
The problem is I am getting a blank page. The list is not getting attached to the page.
Waiting for your reply.
Regards,
Dhani

why not move List definitiaon to XML 
<sap.ui.core.mvc:View xmlns="sap.m" xmlns:sap.ui.core="sap.ui.core" xmlns:sap.ui.core.mvc="sap.ui.core.mvc" controllerName="com.arteria.view.CustomerList"> 
    <Page title="Customers" showNavButton="true"> 
<List id="CustomerList"/>
   </Page> 
</sap.ui.core.mvc:View> 
so
oList = this.byId("CustomerList");
oList.setModel(oModel); 
                oList.bindItems("/Customers", oTemplate, null, null); 
                var custListPage = sap.ui.getCore().byId("idCustomerList"); 
                custListPage.addCustomData(oList); 

Similar Messages

  • Unable to capture data from drop down list in custom added field in migo tcode at item level

    Hi guys,
    need bit help in resolving query related to custom added field in Tcode migo.
    i have added a field in migo at item level ,in this i have used drop down list
    to get data but unable to capture data from drop down list.gown through
    many blogs in scn but unable to resolve.
    Please help me out in this.
    Thanks,
    Umakant.

    Hi,
    U can use following code to fill the list box
    write this code in PBO
    In layout editor please select listbox in dropdown attribute of input field and put some fctcode attribute
    TYPE-POOLS vrm.
      DATA values TYPE vrm_values WITH HEADER LINE.
      TABLES: <ur custom Database table>.
      clear values, values[].
      SELECT * FROM <ur custom Database table>.
        values-text = <TABLE FIELD TO DISPLAY IN DROPDOWN> .
        values-key = <TABLE KEY FIELD TO DISPLAY IN DROPDOWN>.
        APPEND values.
      ENDSELECT.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = '<SCREEN INPUT FIELD NAME>'
          values          = values[]
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    Also please define the following before accessing the listbox value
    data: <listbox input field name> type <table field name>,
            <inputfield name where text to display> type string  in top include
    In PAI, select the text from the table into <inputfield name where text to display>  depending on value selected which will be called when enter key is pressed or any vale is selected

  • How to access listbox binding data from a button which is not part of listbox in xaml page

    Hi
    I have the below listbox and its bdining as below
     <ListBox x:Name="listMyPosts" ItemsSource="{Binding Path=MyPostsDataSource}" Grid.Row="0"  >
               <ListBox.ItemTemplate >
                          <DataTemplate >                                      
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding
    NewPostText ,Mode=TwoWay}"/>
                                            <TextBlock Text="{Binding
    NewPostSender}"/>
                                        </StackPanel>                                      
                                </DataTemplate>
                </ListBox.ItemTemplate>
               <Button content="Send Post" command ="Binding SendClickCommand} />
      </ListBox>
    And i am assining postsViewmodel
    private PostsViewModel _PostsViewModel ;
    public Conversation()
    InitializeComponent();
    _PostsViewModel = new PostsViewModel ();
    this.DataContext = _PostsViewModel ;
    public ObservableCollection<PostsModel> MyPostsDataSource
    get
    if (_MyPostsDataSource== null)
    _MyPostsDataSource= GetMyPosts();
    return _MyPostsDataSource;
    set
    this._MyPostsDataSource = value;
    RaisePropertyChanged("MyPostsDataSource");
    is that possible to access listbox binding data from the ViewModel's SendClickCommand property ?
    Krrishna

    If you need to pass to the command selected item, try this
    <Button Сontent="Send Post"
          Сommand ="{Binding SendClickCommand}"
          CommandParameter={Binding ElementName=listMyPosts,
    Path=SelectedItem}/>
    msdn

  • Inserting data from  a table  to an XML file

    I want to insert the values from this xml file emp.xml into a table Employees :
    <EMPLOYEES>
    <EMP>
    <EMPNO>7369</EMPNO>
    <ENAME>SMITH</ENAME>
    <JOB>CLERK</JOB>
    <HIREDATE>17-DEC-80</HIREDATE>
    <SAL>800</SAL>
    </EMP>
    <EMP>
    <EMPNO>7499</EMPNO>
    <ENAME>ALLEN</ENAME>
    <JOB>SALESMAN</JOB>
    <HIREDATE>20-FEB-81</HIREDATE>
    <SAL>1600</SAL>
    <COMM>300</COMM>
    </EMP>
    <EMP>
    </EMPLOYEES>
    and here is my Employee table in Oracle 9i database
    SQL> DESC EMPLOYEE;
    Name Null? Type
    EMPNO NUMBER
    EMPNAME VARCHAR2(10)
    JOB VARCHAR2(10)
    HIREDATE DATE
    SAL NUMBER
    After getting help from the members i was able to do the insert of data from the xml file to the table..how to do the insert of data from the table to the xml file.
    Regards,
    Renu

    Hello michaels , thank you for the solution, still i am having some problems
    Here is what i have done :
    1.
    SQL> CREATE DIRECTORY my_table_dir AS 'E:\table_files'
    2 ;
    Directory created.
    2.
    SQL> select * from myemp;
    ENAME
    SMITH
    ALLEN
    3.
    This is the content of the existing xml file saved in the directory E:\table_files as emp.xml
    <EMPLOYEES>
    <EMP>JIM</EMP>
    <EMP>RICK</EMP>
    </EMPLOYEES>
    4.
    Now i executed this code :
    declare
    emp_xml xmltype;
    begin
    select sys_xmlagg (column_value, sys.xmlformat ('EMPLOYEES')) emp_xml
    into emp_xml
    from table (xmlsequence (cursor (select *
    from myemp
    where ename in ('SMITH', 'ALLEN')),
    sys.xmlformat ('EMP')
    dbms_xslprocessor.clob2file (emp_xml.getclobval (), 'E:\table_files', 'emp.xml');
    end;
    And the Error i got is :
    declare
    ERROR at line 1:
    ORA-29280: invalid directory path
    ORA-06512: at "SYS.UTL_FILE", line 18
    ORA-06512: at "SYS.UTL_FILE", line 424
    ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 46
    ORA-06512: at line 12

  • How to send a data from combobox to list box in java  when I click datas

    ow to send a data from combobox to list box in java when I click datas in combobox

    use getItemAt() from combo and add them to list model.

  • Import/export data from ms sql 7 to xml file in a particular xpdl format

    I'm trying to write java program to import/export data from ms sql 7 to xml file in a particular xpdl format. Can anyone suggest how to do it?

    take a glance at what these guys do: http://www.openbusinessengine.org/docs/guide.html

  • ABAP program to output data from SAP table to an XML format file?

    hello ABAP experts,
    Does anyone know how to output data from SAP table to an XML format file?  Would be appreciated if someone show the detailed sample codes and we will give you reward points!
    Thanks!

    Edited by: Jose Hugo De la cruz on Aug 19, 2009 8:23 PM

  • Troubles to retrieve data from a sharepoint List 2013

    Im having some troubles when i try to retrieve data from a list in sharepoint 2013.
    SPSite osite = new SPSite(@"http://contoso.com");
    SPWeb web = osite.OpenWeb();
    SPList list = web.Lists["Calendar"];
    SPListItemCollection collection = list.Items;
    foreach (SPListItem item in collection)
    Console.WriteLine(item["Title"]);
    And im getting this error: System.InvalidOperationException: Exception of type 'System.InvalidOperationException' was thrown.
    I did a research in MSDN and i could connect to a diferent list in SharePoint 2010 using Visual Studio 2010, but now im using Visual Studio 2012 to connect to SharePoint 2013 and i dont get the same result.
    Im using the DLL Microsoft.SharePoint. 15.0.0.0 
    Thanks!

    I am not able to trace what could be causing the issue, as I would probably need to look at the entire code. But I quickly put together few lines of code and they seem to work for me on SP 2013 as well as 2010. I have modified your code on these lines, can
    you please try the following and let me know if it works:
    SPSite osite = new SPSite("http://contoso.com");
    SPWeb web = osite.OpenWeb();
    string Url = web.ServerRelativeUrl + "/lists/Calendar";
    SPList list = web.GetList(Url);
    SPListItemCollection collection = list.GetItems();
    foreach (SPListItem item in collection)
    Console.WriteLine(item["Title"]);
    The following link talks about the SPList.GetItems method, hope this helps.
    http://msdn.microsoft.com/en-us/library/ms457534(v=office.15).aspx
    Vishal

  • Аdding department export data from a survey list from user profile services in Sharepoint 2013.

    When voting, survey Sharepoint 2013, there is a field created by whom. But the name is not enough. Necessary to add the department name of the profile data in the exported list excel.

    Hi,
    The OOTB feature “Export to Spreadsheet” won’t contain the department in the exported report, we will need to create a custom one programmatically.
    We can use SharePoint Object Model to retrieve the data from the Survey and the User Profile Service, then generate an Excel Spreadsheet with the data we need.
    SharePoint Object Model -
    SPListItem class
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.aspx 
    Add, Update and Delete List Items Programmatically in SharePoint
    http://www.mindfiresolutions.com/Add-Update-and-Delete-List-Items-Programmatically-in-Sharepoint-372.php 
    More information about
    SharePoint Object Model:
    http://msdn.microsoft.com/en-us/library/ms473633.ASPX
    How to: Work with user profiles and organization profiles by using the server object model in SharePoint 2013
    http://msdn.microsoft.com/en-us/library/office/jj163142(v=office.15).aspx
    For about
    generating an Excel document:
    http://www.codeproject.com/Articles/20228/Using-C-to-Create-an-Excel-Document
    Or you can post another question to
    Excel for Developers for about creating an Excel file programmatically:
    http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=exceldev
    Feel free to reply if there are still any questions.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Import data from Excel to list in Sharepoint Online site

    I need to upload data from excel to SharePoint list in SharePoint online site.
    I can extract data from excel but how can i connect to the SharePoint online site and upload the data programmatically from a console exe.
    Kindly advice.
    Anand B

    Hi Anand,
    You can export data from Excel or Access to a SharePoint list if you are using tables.
    http://office.microsoft.com/en-in/excel-help/export-an-excel-table-to-a-sharepoint-list-HA010131472.aspx#BMexporttable

  • How can i populate the Jcombobox with the data from my jpa list? Desperate

    I need to populate my jcombobox with data from my jpa. This is my first time trying this and i just need some sample or a quick solution to this. Thanks in advance
    <code>
    public static MyNames myNames() {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("JavaTrialsPU");
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    Query q = em.createNamedQuery("MyNames.findAll");
    MyNames n = (MyNames) q.getResultList();
    return n;
    public static void myCombo() {       
    comboBox = new JComboBox(????--how can i make the jcombobox display my myNames() list--?????);
    frame.add(comboBox, BorderLayout.PAGE_START);
    </code>

    Implement toString() on your entity to return whatever you want to use as a label for the combobox.
    Your need for quick solutions is very destructive to your learning process. In stead take the time and read around a little. Swing happens to have an excellent tutorial with many example programs readily available for you to pick through:
    http://docs.oracle.com/javase/tutorial/uiswing/
    And PS: you need to use \ tags in this forum.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Exporting data from database tables to a XML file

    Hi,
    We want to export data from Oracle database tables to an XML
    file. What tool can we use for this purpose, and how do we go
    about it ?
    Can we extract data only from an Oracle8 database, or can we
    extract data from Oracle7.3 databases too ?
    Any help in this regard would be appreciated.
    Thanks
    Dipanjan
    null

    Dipanjan (guest) wrote:
    : Hi,
    : We want to export data from Oracle database tables to an XML
    : file. What tool can we use for this purpose, and how do we go
    : about it ?
    : Can we extract data only from an Oracle8 database, or can we
    : extract data from Oracle7.3 databases too ?
    : Any help in this regard would be appreciated.
    : Thanks
    : Dipanjan
    Start by downloading the XML SQL Utility and make sure you have
    the approriate JDBC 1.1 drivers installed for your database.
    There are samples which will get you going included in the
    archive.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Reading data from App Web List and Displaying in HostWeb.

    Hi,
    Is it possible to read list data from AppWeb and display it on a page in HostWeb?
    Any approaches to achieve this?
    Regards,
    Rivin Jose.

    Hi Rivin,
    There seems no need to query an app web from host web cause App for SharePoint is designed to work as an “advanced web part” solution, it should work as a separate
    component of a SharePoint site which shouldn’t be taken care on the host web side.
    If you simply want to display data from app web in the host web, add an App Part into a page in the host web would be the best option for you as what Dan suggests.
    Thanks         
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Updating a table with the data from the select list

    I have 2 select lists on a page...first select list displays vendor no and vendor name from the table vendor (vendor_no, vendor_name, address, city, state, zip, ph no)
    second list displays contact no and contact name from the table contact (contact_no, contact_name, email_addrs)
    i have a submit button...once it is clicked the vendor_no from the first list and the contact_no from the second list must be inserted into the third table vendor_contact (vendor_contact_no, contact_no, vendor_no) and also there must be a condition to check if the entry already exists or not...can any one tell me how this can be done...

    Why not design your page just on your third table (vendor_contact), and those fields (which will already be defined as part of that table) can be defined there as your select lists. Then make sure you have a Primary Key (or Unique Key) defined on the table to prevent duplicates.
    It makes for a much cleaner looking page, and far easier to implement as well.
    Hope this made sense and helps.
    Bill Ferguson

  • Sql query to bind data from grid and print total count and amount total when date changes

    SELECT SLHD.VOUCH_CODE,SLHD.VOUCH_DATE,SLHD.VOUCH_NUM,SUM(SLTXN.CALC_NET_AMT) AS AMT,ACT.ACT_NAME,SUM(SLTXN.TOT_QTY) AS QTY
    FROM SL_HEAD20132014 AS SLHD,ACCOUNTS AS ACT,SL_TXN20132014 AS SLTXN
    WHERE SLHD.ACT_CODE=ACT.ACT_CODE AND SLTXN.VOUCH_CODE=SLHD.VOUCH_CODE
    GROUP BY SLHD.VOUCH_CODE,SLHD.VOUCH_DATE,SLHD.VOUCH_NUM,ACT.ACT_NAME
    ORDER BY SLHD.VOUCH_DATE 
    i want to print total quatity and total sale in grid when data changes
    like
    date amount quantity
    01/02/2013 1200 1
    01/02/2013  200 1
    01/02/2013  1400 2 // date changes here 
    02/03/2013 100 1 
    02/03/2013 50 4
    02/03/2013 150 5 // date changes and so on

    this query only print all the data from table i want total quantity and total amount of daily sale in same grid when ever date changes
    You may add the date filter to Visakh's query:
    SELECT SLHD.VOUCH_DATE,SUM(SLTXN.CALC_NET_AMT) AS AMT,SUM(SLTXN.TOT_QTY) AS QTY
    FROM SL_HEAD20132014 AS SLHD,ACCOUNTS AS ACT,SL_TXN20132014 AS SLTXN
    WHERE SLHD.ACT_CODE=ACT.ACT_CODE AND SLTXN.VOUCH_CODE=SLHD.VOUCH_CODEand SLHD.VOUCH_DATE = @yourdate --passed from the front end application
    GROUP BY SLHD.VOUCH_DATE
    WITH CUBE
    ORDER BY SLHD.VOUCH_DATE
    Having said, each time when you select the date, you query the table would be expensive method. May be you can filter the date within your dataset already populated if you have entire data in the dataset.

Maybe you are looking for

  • Best practice for sharing data with model window

    Hi team, what would the best practice for sharing data with a modal window be ? I use a modal window to display record details from a record list, but i am not quite sure how to access the data from the components in the main application in the modal

  • Compressor taking TOO MUCH TIME

    I've just begun making a podcast, and the first video is of an event that is 2 hours long. I edited in Final Cut, rendered it, and then exported it to Compressor. But when I submit the job, the "time remaining" begins to go up, I had to cancel the co

  • Startup freezes on gray apple screen

    I've restarted twice and it freezes on the gray apple screen. No kernel panic message, no error message, nothing. No peripheral devices plugged in. No new RAM installed. It just decided to start doing this today. Any suggestions? thanks.

  • Unsigning a signed jar

    Hi, I have a signed that I need to make changes to. I thought it would be possible to do this by removing: 1.The digest entries in the manifest 2.Signature file 3.Signature block file However, I get: java.lang.Error: Unresolved compilation problems:

  • How do I find imported bookmarks

    I have imported my bookmarks from IE explorer and google chrome. If I try to bookmark a new page it will ask me which folder I want to put it in. Some of the choices are folders that were imported. If I choose one of these they don't show up in my fi