Skip to Content
avatar image
Former Member

Error While Adding 11th Record in table

Hi All,

I have a form in which there are 10 fields in which i am taking input from user and as soon as user click on add button i am adding all those 10 field values in the table which have associated columns for each field. As soon as i add 11th time application shows me following error.

Cannot read property 'getCells' of undefined

I dont understand why it is happening

Please guide.

regards

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 03, 2015 at 05:55 PM

    i have made follwing changes in my code and my problem get resolved

    if(trCount>0){
        var lastLineNo = aData[trCount-1]["POSNR"];
        lineItemNo = oIntegerFormat.parse(lastLineNo.toString()) + 10;
        console.log(lineItemNo);
       //lineItemNo = oIntegerFormat.parse(oTable2.getRows()[trCount-1].getCells()[15].getValue()) + 10;
        }
    

    The commented out line was giving error on getCells() method i dont understand why, i just removed this line and played in the data array and my problem get resolved.

    Thanks Robin for your support your discussion give me new ways and thanks to all others too who tried to resolve my issue

    Regards

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 02, 2015 at 03:26 AM

    Hi Muhammad

    It is hard to tell without know what you have done. There are many ways to do this.

    Here is one

    Sample

    -D

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      your example is not mapping my issue you have created 10 rows in table however in my case all the fields creating one record in the table and after doing the same addition process for 10 times its showing error, please look it again

      thx.

  • avatar image
    Former Member
    Jun 02, 2015 at 11:41 AM

    hi muhammad,

    Please share the code so it will be easy to understand.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Robin Van Het Hof

      ok let me try it then i will getback to you if i get fail... thx again

      I tried the suggested way in the following manner

      var oBT_SO_AddItem = new sap.ui.commons.Button("oBT_SO_AddItem" , {
            text: "Add Item",
            icon: "images/AddRecord.png",
            press: function(e) {
              if (!oController.validateDetailFields())
                return;
              //AddItemInDetailTable();
              var aData=[];
          aData = this.getView().getModel().getProperty("/modeldata");
          aData.push(
                 {
                   MATNR   : sap.ui.getCore().byId("oTF_SO_Var_Code").getValue(),
                   ARKTX   : oCB_SO_LensType.getLiveValue(),
                   VKAUS   : oCB_SO_LensSide.getValue(),
                   DIA     : oCB_SO_LensSize.getLiveValue(),
                   SPH     : oCB_SO_Lens_SPH.getLiveValue(),
                   CYL     : oCB_SO_Lens_CYL.getLiveValue(),
                   ZADD    : oCB_SO_Lens_ADD.getLiveValue(),
                   KWMENG  : oTF_SO_Quantity.getValue(),
                   NETPR   : oTF_SO_LensPric.getValue(),
                   ZEXCH   : oFloatFormat.parse(oTF_SO_ExtraChg.getValue()).toFixed(2),
                   ZREASON : oTF_SO_ReasonEC.getValue(),
                   NETWR   : oMV_SO_LensAmnt.toFixed(3),
                   VRKME   : oCB_SO_LensUnit.getSelectedKey(),
                   OLDQTY  : oTF_SO_Quantity.getValue(),
                   PROQTY  : oTF_SO_Quantity.getValue(),
                   POSNR   : lineItemNo,
                   AUFLG   : "POST",
                   WERKS   : oCB_SO_DelvSite.getSelectedKey()
                 }
               );
          this.getView().getModel().setProperty("/modeldata", aData);
      

      and received following message

      Uncaught TypeError: this.getView is not a function