cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Table clear Column content

jakob_steen-petersen
Active Participant
0 Kudos

Hi

I want to provide the user with a button which can clear all Input content of a particular Column.

I.ex. if i have a Table with 7 rows; SalesOrderItem, ItemText, ItemValue

How do i clear ItemValue in all rows of table?

Is thre an easy way?

View Entire Topic
sergey_muratov
Participant
0 Kudos

Hi,

You need to clear data in your table's model. Then you contol will be updated automatically.

jakob_steen-petersen
Active Participant
0 Kudos

Whel i did it the other way:

  var items = this.byId("itemTable").getItems();
  for(var i = 0, len = items.length;i<len; i++){
   var cells =  items[i].getCells();
   cells[2].setValue();
   cells[3].setValue();
   cells[6].setValue();
   if (cells[8].bOutput === true){
      cells[8].setEnabled(false);
    }
   }

The only issue is the last one: cells[8] is a Checkbox and i need to set it to unchecked. setEnabled is not checked/unchecked - but i can´t get the right one?!

jakob_steen-petersen
Active Participant
0 Kudos

Update:

Found it 🙂

cells[8].setSelected(false);

former_member373424
Discoverer
0 Kudos

Hello Jakob,

I am with Sergey, using the model will give you a solution easier to maintain in future.

Regards