How to insert one blank row in table using ODataModel?

Hi,
I have a table in which the data is being shown using ODataModel. Now I want to add a new row dynamically when user clicks on 'New' button. For this I know using JsonModel it would be something like below where every field in the table is almost  blank as I want users to enter the data in it and later I want to save the data in the model at server:
var tableModel = table.getModel();
  var tableData = timeSheetTable.getModel().getData();
  tableData.modelData.push({"workItem":"item5","day1":"","day2":"","day3":"","day4":"","day5":"","day6":"","day7":""});
   tableModel.setData(tableData);
  timeSheetTable.setModel(tableModel);
How this thing can be achieved using ODataModel? I can't push data like what is shown above.
I tried searching examples for this but no luck. Any help would appreciated.
Thanks,
Supriya Kale

Hi,
I have a table in which the data is being shown using ODataModel. Now I want to add a new row dynamically when user clicks on 'New' button. For this I know using JsonModel it would be something like below where every field in the table is almost  blank as I want users to enter the data in it and later I want to save the data in the model at server:
var tableModel = table.getModel();
  var tableData = timeSheetTable.getModel().getData();
  tableData.modelData.push({"workItem":"item5","day1":"","day2":"","day3":"","day4":"","day5":"","day6":"","day7":""});
   tableModel.setData(tableData);
  timeSheetTable.setModel(tableModel);
How this thing can be achieved using ODataModel? I can't push data like what is shown above.
I tried searching examples for this but no luck. Any help would appreciated.
Thanks,
Supriya Kale

Similar Messages

  • Update multiple rows in table using ODataModel.

    I have tied ODataModel with table using "TwoWay" binding. I need to allow user to edit the rows of the table at the bottom of which I have 'Save' button. Currently though the table is editable I am unable to edit the entries in multiple rows of the table.
    Please find my code below:
    var oTable = new sap.ui.table.Table("dprTable",{
      visibleRowCount: 4,
      visible: true,
      navigationMode: sap.ui.table.NavigationMode.Paginator
      var oColumn = new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "DBR/DPR"}),
      template: new sap.m.Link({
      "target": "_blank",
      press:[controller.onClickDemoNo,controller]
      }).bindProperty("text","DemoId"),
      width: "auto",
      tooltip: "DBR/DPR"
      oTable.addColumn(oColumn);
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Description"}),
      template: new sap.ui.commons.TextView().bindProperty("text", "DemoDesc"),
      width: "auto",
      tooltip: "Description"
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Required Date"}),
      template: new sap.ui.commons.DatePicker("",{
      value:{
      path:"ReqDate",
      type: new sap.ui.model.type.Date({pattern: "dd-MM-yyyy"})
      change: function(){
      console.log('the date is changed and it\'s value is'+value);
      width: "auto",
      tooltip: "Required Date"
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Requestor"}),
      template: new sap.ui.commons.TextView().bindProperty("text", "RequestorName"),
      width: "auto",
      tooltip: "Requestor"
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Requestor/Project Lead"}),
      template: new sap.ui.commons.TextView().bindProperty("text", "LeadName"),
      width: "auto",
      tooltip: "Requestor/Project Lead"
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Solution"}),
      template: new sap.ui.commons.TextView().bindProperty("text", "SolutionText"),
      width: "auto",
      tooltip: "Solution"
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Start Date"}),
      template: new sap.ui.commons.DatePicker("",{
      value:{
      path:"StartDate",
      type: new sap.ui.model.type.Date({pattern: "dd-MM-yyyy"})
      width: "auto",
      tooltip: "Start Date"
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "End Date"}),
      template: new sap.ui.commons.DatePicker("",{
      value:{
      path:"StartDate",
      type: new sap.ui.model.type.Date({pattern: "dd-MM-yyyy"})
      width: "auto",
      tooltip: "End Date"
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Estimated Duration"}),
      template: new sap.ui.commons.TextView().bindProperty("text", "EstDuration"),
      width: "auto",
      tooltip: "Estimated Duration"
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Hours"}),
      template: new sap.m.Input("",{}).bindProperty("value", "ActDuration"),
      width: "auto",
      tooltip: "Hours"
      oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Status"}),
      template: new sap.ui.commons.ComboBox({items: [
      new sap.ui.core.ListItem({text: "New",key:"1"}),
      new sap.ui.core.ListItem({text: "In Process",key:"2"}),
      new sap.ui.core.ListItem({text: "Completed",key:"3"})
      ]}).bindProperty("value","StatusText"),
      width: "auto",
      tooltip: "Status"
      oTable.setBusyIndicatorDelay(1);
      //oData service call
      var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZSECENTRAL_SRV",true);
      oModel.setDefaultBindingMode("TwoWay");
      oModel.attachRequestSent(function (oEvent) {
      console.log('request sent');
      oTable.setBusy(true);
      oModel.attachRequestCompleted(function () {
      console.log('request completed');
      oTable.setBusy(false);
      });os
      oModel.attachRequestFailed(function () {
      oTable.setBusy(false);
      oTable.setModel(oModel);
      oTable.bindRows("/DEOPENDBRSet");
    Is there something pending in the settings? And to update the multiple records in the table do I have to make use of some batch operations? Any help would be appreciated.
    Thanks,
    Supriya Kale

    Hi Supriya,
    your code is missing call of oModel.submitChanges() when Save button is called.
    You can find the example here SAPUI5 SDK - Demo Kit
    Regards,
    Peter

  • How to insert a new Row in table - Need help

    Hi everyone,
    I'm using JHeadstart 10.1.2, UIX pages and STRUTS.
    This is my situation: My page1 has a table (table1) and when I select one line from table1 and press a button, I go to page 2.
    I have an action in the Struts-Config.xml file, so I can pass some parameters to page2, like this:
    <action path="/S2PopUpObstaculos" <=PAGE2 type="oracle.jheadstart.controller.strutsadf.action.JhsDataActionSaveObstaculos" className="oracle.jheadstart.controller.strutsadf.action.JhsDataActionMapping" parameter="/WEB-INF/page/S2PopUpObstaculos.uix" name="DataForm">
    <set-property property="modelReference" value="S2AltaSociais2UIModel"/>
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=${data.S2AltaSociais2UIModel.Obstaculo},${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},${data.S2AltaSociais2UIModel.Obstaculo}"/>
    </action>
    But now, the problem is, if I don't select one Row from table1 and press the button to go to page2, I need to pass diferent parameters to page 2, like this:
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=0,${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},0"/>
    </action>
    Do you have any ideia how to do this? Can ayone help me?
    Thanks,
    Atena
    Message was edited by:
    Atena

    Hi Sascha,
    thanks very much for your replay.
    My project changed and I have another question about this. My page1 has a table (table1) and when I select one line from table1 and press a button, I go to page 2.
    I have an action in the Struts-Config.xml like this in page2 (S2PopUpObstaculos):
    <action path="/S2PopUpObstaculos" type="oracle.jheadstart.controller.strutsadf.action.JhsDataActionSaveObstaculos" className="oracle.jheadstart.controller.strutsadf.action.JhsDataActionMapping" parameter="/WEB-INF/page/S2PopUpObstaculos.uix" name="DataForm">
    <set-property property="modelReference" value="S2AltaSociais2UIModel"/>
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=${data.S2AltaSociais2UIModel.Obstaculo},${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},${data.S2AltaSociais2UIModel.Obstaculo}"/>
    </action>
    But now, the problem is, if I don't select one Row from table1 and press the button to go to page2, I need to pass diferent parameters to page 2, like this:
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=0,${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},0"/>
    </action>
    Do you have any ideia how to do this? Can you help me?
    Thanks,
    Atena

  • How to insert chinese characters in a table use FDK?

    Hello~~
    I am expecting to insert chinese characters in an XML file's table.
    I'm using FDK7.2,  if i use:
    F_ApiAddText(docId, &tRange.beg, "asdf");
    The English letters "asdf" can be insert correctly in the right place,
    But,  if insert chinese characters like this:
    F_ApiAddText(docId, &tRange.beg, "人们");
    No characters insert.
    How can i solve this problem?
    Please advise
    Thanks
    zhaopeng

    Zhaopeng,
    Which encoding are you using for the Chinese characters? FrameMaker 7.2 does not support Unicode or UTF-8. I have not done this before, but I guess you need to supply the characters in Big5 resp. GBK encoding, see
    http://help.adobe.com/en_US/FrameMaker/8.0/chinese_korean.pdf
    [Ignore the 8.0 in the URL, the document talks about FrameMaker 7]
    You also may have to make sure the paragraph format at your text location uses a Chinese font before inserting characters.
    - Michael

  • How to update all the rows of table using stored procedures

    Hi,
    I want to update all the rows of a table of a specific column
    sp_a  male
    sp_b female
    sp_c  male
    sp_d female
    in above table 
    gender of all the columns has to be interchanged.

    Sir table is like this detail(name varchar(10),gender varchar(10))
    Where Details  are like this 
    Name  Gender
    sp_a 
    male
    sp_b
    female
    sp_c 
    male
    sp_d
    female
    I want to create a stored procedure which automtically updates gender from male to female and female to male
    for all the rows . i.e., all the rows are updated for column gender by just running a stored procedure.
    So after execution of stored proc the above table looks
    Name  Gender
    sp_a 
    female
    sp_b
    male
    sp_c 
    female
    sp_d
    male

  • How to insert a value  in a table using another table

    My table is like this
    col1 col2 col3
    india
    Pakistan
    my doubt is if i insert India in a table it will automatically insert India Id or code into another table
    output i want is like this
    col1 col2
    10
    20
    please give the exact query.

    u will have to use triggers to achieve the functionality..

  • How can I update multiple rows in table using a single form button and checkboxes

    I have a project where the visitors can select multiple productos and once the click on the PURCHAS button it updates the selected records.

    You have not mentioned the programming language that you are using, but here's a link that could help you if you are using ASP.
    http://csharpdotnetfreak.blogspot.com/2009/05/edit-multiple-records-gridview-checkbox.html
    Also, have a look at this discussion thread
    http://forums.asp.net/t/1470882.aspx

  • How to insert one table data into multiple tables by using procedure?

    How to insert one table data into multiple tables by using procedure?

    Below is the simple procedure. Try the below
    CREATE OR REPLACE PROCEDURE test_proc
    AS
    BEGIN
    INSERT ALL
      INTO emp_test1
      INTO emp_test2
      SELECT * FROM emp;
    END;
    If you want more examples you can refer below link
    multi-table inserts in oracle 9i
    Message was edited by: 000000

  • How to insert data into the mysql table by giving as a text file

    Hi,
    Any one know's how to insert data into the mysql table by giving as a text file as the input in JSP.Please respond ASAP.
    Thanks:)

    At least you can try StringTokenizer to parse your text files. Or download a text JDBC driver to parse your files, for instance, HXTT Text(www.hxtt.net) or StelsCSV(www.csv-jdbc.com).

  • How to Fix the 1st row in Table

    How to Fix the 1st row in Table
                 In EP, one of the page we are getting out put in the table format. It's working fine, but as per the new requirement we have to fix (freeze) the first row of the table. (.i.e. whenever I click the page down button first row should be visible in the table). Can you help regarding the above issue?
    For Example: in Table having 6 rows. In 1st row display Year Month and 2,3,4---etc Rows will display Quantity. Click on Page down Button in Table we are able to staring 2row. First was a movie up. So End user canu2019t find which year/moth under the Quantity is available.
    So I have to fix in 1st row. Click on page down button table 1st row is fixed but comes to another Quantity Records.
    It is Possible in Table?  If possible please tell me.
    Regards
    Vijay Kalluri

    Hi KalluriVijay 
    I don't think there is direct availabe method available to fix the row. However, there are two ways using which you can achieve the requirement:
    To go ahead with the custom table. This way you can set your own properties for the table. However, this may impact performance handling large data.
    Second option is to use other features of NW04s (Not available in NW04) like Table Popins using which you can achieve something similar.
    For Table Popins refer [TablePopin|http://help.sap.com/saphelp_nw70/helpdata/EN/23/5e9041d3c72e7be10000000a1550b0/frameset.htm]
    Hope this helps.
    Regards
    Abhinav Sharma

  • INSERTing a blank row in the result set

    Hi friends,
    SELECT * FROM EMPLOYEES ORDER BY DEPARTMENT_ID;
    In the result of the above, I need to INSERT a blank row in the result for each DEPARTMENT_ID. i.e., the result should look like the following:
    EMP_ID - NAME - SALARY - DEPARTMENT_ID
    101 - Albert - 10,000 - 10
    102 - Benjamin - 8,000 - 10
    103 - Chitra - 10,500 - 20
    104 - David - 4,500 - 20
    105 - Elango - 6,000 - 20
    106 - Fathima - 6,000 - 30
    107 - Ganga - 9,000 - 30
    etc.
    I don't want to insert into the table. Just in display I need a blank row.
    Thanks in advance.
    Edited by: Iniyavan on Mar 8, 2010 11:37 AM

    Are you looking for this?
    satyaki>select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    14 rows selected.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>break on deptno
    satyaki>
    satyaki>
    satyaki>select empno,
      2            ename,
      3            sal,
      4            deptno
      5     from emp
      6     order by deptno;
         EMPNO ENAME             SAL     DEPTNO
          7782 CLARK            2450         10
          7839 KING             5000
          7934 MILLER           1300
          7566 JONES            2975         20
          7902 FORD             3000
          7876 ADAMS            1100
          7369 SMITH             800
          7788 SCOTT            3000
          7521 WARD             1250         30
          7844 TURNER           1500
          7499 ALLEN            1600
         EMPNO ENAME             SAL     DEPTNO
          7900 JAMES             950         30
          7698 BLAKE            2850
          7654 MARTIN           1250
    14 rows selected.
    Elapsed: 00:00:00.04
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • How to insert a new row in the middle of an set of rows

    Hi
    How to insert a new  row in the middle of an set of rows ? and How to Reset the line id after the new row added ?
    Regards,
    Sudhir B.

    Hai,
    just try this,
    Instead of using omatrix.Addrow(1,-1) use like
    omatrix.AddRow( RowCount , Position)
    RowCount
    The number of rows to add (default is 1)
    Position
    The position of the new rows (0-based; default is -1, meaning append row to the end)
    After adding rows in matrix For, sno.
    for i=1 to omatrix.visualrowcount
    otext=omatrix.getcellspecific("columnid",i)  '--where columnid is the unique id of the sno column
    otext.value=i
    next i
    Hope this helps you.
    Thanks & Regards,
    Parvatha Solai.N

  • How to insert a record in ROOSPRMSC table? (accidentally deleted)

    Calling an InfoPackage in BW causes short dump, while fixing the short dump issue, accidentally
    deleted the "ROOSPRMSC" table entries.
    Could you tell me how to insert a record in "ROOSPRMSC" table???

    Hi Senthil,
    Regards,
    Phani Raj Kallur
    Message was edited by: Phani Raj Kallur

  • How to count number of rows in table

    can I get number of row in table except Count(*) in pl/sql
    is there any other way

    Also posted and answered here
    how to count number of rows in table
    count(*) will be the fastest way. It is only slow if the table has a vast number of rows, in which case why do you need to know the tables has 73552436467721 rows and not 73552436467737 rows. It doesn't seem to be much use. Either that or you are counting them a lot, which again seems rather pointless.

  • Blank row in table UI Element

    Hi All,
    I am having a UI table element in my screen. Below that i ve some input fields. When i lead select a row in table, the input field data changes accordingly.
    When i do not have a row in the table, am getting an error message saying no value for the input field.
    So when there is no row in table, if i append a blank row. It is working fine. Can anyone give someother solution for this issue.??
    Because in this solution we have a blank row in table when the table is empty. We do not want this blank row
    Am binding the table and the input fields below to the same node. (So that the table row data automatically reflects in the input fields below).

    hii ,
    u shud try using this :
    1 create a context attribute , say attr1 ,of type string under a separate node of cardinality 1..1 or 1..n ,say context node is cn_all.
    2 bind this attribute  attr1 with the value property of the ur UI element INput Field's .
    3 set the value of ur attribute of attr1 in ONLEAD SELECT of the  TABLE .
      DATA lo_nd_cn_all TYPE REF TO if_wd_context_node.
        DATA lo_el_cn_all TYPE REF TO if_wd_context_element.
        DATA ls_cn_all TYPE wd_this->element_cn_all.
        DATA lv_attr1 LIKE ls_cn_all-attr1.
    *   navigate from <CONTEXT> to <CN_ALL> via lead selection
        lo_nd_cn_all = wd_context->get_child_node( name = wd_this->wdctx_cn_all ).
    *   get element via lead selection
        lo_el_cn_all = lo_nd_cn_all->get_element(  ).
    *   set single attribute
        lo_el_cn_all->set_attribute(
          EXPORTING
            name =  `ATTR1`
          IMPORTING
            value = lv_attr1).
    in this way , u wud not be creating the empty rows , also wud not get runtime error for ur Input field
    regards,
    amit

Maybe you are looking for

  • Unable to upload the PAR from NWDS

    Hi , I am unable to upload the par from NWDS as it is throwing the error "Unable to upload" I have done the proxy settings in NWDS. can any one tell me is there any other settings i have to do in NWDS. Thanks Ajay

  • DE -saster.  How can I reverse and go back to acrobat on a mac?

    I have no time for this nonsense. $100 book that I could read passibly on acrobat, and I foolishly clic on the download the new edition "yes" teaser. Now I'm stuck in this Digital Edition and can't get back. No thumbnails where there used to be, and

  • Request for a GOP UEFI bios for R9 270 gaming 2g

    Request for a GOP UEFI bios for R9 270 gaming 2g thank you

  • Printing: JDE BIP & Troy Font

    Environment: JDE & BIP Printer Type: HP (PCL type printer) Troy Font: Troy E13B.ttf Why utilize the Troy font .... security. The Troy font is where it appears in reverse locally but the printer will convert it to the correct font. History: 1. After c

  • Using iPod to transfer music to separate PC

    I want to use my ipod to transfer music from my hardrive onto my daughters PC (which has no internet access). Sounds simple but I can not seem to do. Any ideas?   Windows XP Pro