Skip to Content

How to capture the Table cel event and validate the only that cell data


I have m table. displaying 10 column data. From column 3 to 10 displays the numbers. Those columns are editable. user enter the numbers.

for each three rows i have another row which is not editable, I need to display the totals of the number entered by the last three rows numbers corresponding columns, Like the following format i have some dynamic rows.

For example

IdNo Name jan Feb Mar apr May Jun July Aug

12354 XYZ 4 3 2 5 6 1 2 4

456223 ABC 2 5 1 2 5 2 1 6

33566 DEF 2 5 1 2 5 2 1 3

Total hours 8 13 4 9 16 5 4 13

If the user try to enter any number in the editable cells, i need to capture the perticular cell data number and i need to calculate the Total for that column to display in total row. Before calculating the total, i need to check the entered no is valid based on the requirement formula. if that entered no is not valid to use, i need to show the particular cell state as error state.

But when i use the following code using the change event(); it is going throw whole row for that event , i need to capture the event for the particular cell data alone. how to achieve this. in the first if loop i am trying to validate for the numaric, incase if if is numaric it goes to else loop, i need to validate the entered hours for that cell alone by calling different method in the else loop , if the entered hours are not available based on some formula for that celli need to show the error for that row by error state. but it is going through all the cells in that row except first and 2nd.

but it is itrerating only from 2nd column to last column only. It is not iterating the first and 2nd column, those two clumn are are not editable. how to read the first and column and 2nd clumn data? bcz i need the idno available in first column to validate the respective month column data. how to achieve this.

Change : function(oEvent){

var tVal = 0;

var oRow = oEvent.oSource.getParent();

var aCells = oRow.getCells();

for(var i = 2; i < aCells.length-1;i++)




console.log('Not Valid Nan');



aCells[i].setValueState(sap.ui.core.ValueState.Error);"Special characters not allowed");


userEnteredHours = colVal;


//get the month from MonthArray

monthObj =monthsArry[i];

monthIndex =i;

console.log ("validateEnteredHours :: monthIndex-->"+monthIndex);

//resourceId =aCells[0];

console.log ("validateEnteredHours :: resourceId-->"+resourceId);





Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Dec 15, 2015 at 12:35 AM

    Hi Guru,

    Did you bound your table to a model? If so, why don't you fetch the values from model? Please do not fetch values from control.

    Try something like this -

    Change: function(oEvent){
         var oSource = oEvent.getSource();
         var oItem = oSource.getParent();                              //Get Corresponding Table Item
         var oContext = oItem.getBindingContext();            //Get the binding context of the table item.
         var oModelObject = oContext.getObject();                  //Get Object
         var oIdNo = oModelObject.IdNo;                    //Gives you the IdNo of table item
         var oName = oModelObject.Name;               //Gives you the Name of table item
         //and so on for other values in the table item.....


    Sai Vellanki.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.