cancel
Showing results for 
Search instead for 
Did you mean: 

how to make single column editable in smart table

0 Kudos

Hi Experts,

am trying to create a smart table which needs to have an editable column. We are using the OData metadata to generate the columns in smart table. We have smart table property (editable = "true") which is making all columns in table are editable. But i need to have only single column as editable column. Please find the screenshot for sample screen.

Kindly suggest how we can achieve this.

ashok_dhayalaraj
Explorer
0 Kudos

Hi,

I am facing the same issue, I would like to edit the rows I select as editable and then change the values and post them into the database. Please help.

0 Kudos

Hi ,

I am also facing the same issue. Does anyone has any solution ?

haemma83
Active Participant
0 Kudos

Hello,

I got the same issue and most of all - my input fields are not scrollable..

former_member781986
Discoverer
0 Kudos

Hey Andreas,

Same here. I have added custom column, but my the table look changes, scroll bar is vanished. Did you get any solution to this?

Accepted Solutions (0)

Answers (4)

Answers (4)

matthew_vincent
Explorer

You need a few things in place to control the editing of fields in your SmartTable

  • TwoWay binding mode
  • editTogglable="true" attribute on your SmartTable
  • customData:useSmartField="true" on your SmartTable
  • fieldChange="onFieldChange" on your SmartTable
  • Updatable tick box on your Entity Set in SEGW transaction
  • Updatable tick box for the specific fields on your Entity Type in SEGW transaction

Notes:

customData namespace is defined in your view xml

xmlns:customData="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"

onFieldChange is defined in your view controller file and would contain the logic to set changes back to your webservice

onFieldChange: function(evt) {
  var change = evt.getParameter("changeEvent");
  if (change) {
    var newValue = change.getParameter("newValue");
    var src = change.getSource();
    // get the data binding and send the changes via your appropriate web service
  }
},

There are few ways to define TwoWay binding on an OData model, one is to add defaultBindingMode to your manifest file

"models": {
  "": {
    "dataSource": "myDataSource",
    "settings": {
      "useBatch": false,
      "defaultBindingMode": "TwoWay"
    }
  }
},
haemma83
Active Participant
0 Kudos

Hello Mahenaz!

I got it to work. The most important thing is the two-way binding. You have to be sure that the custom values are bind. Otherwise you won't be able to scroll.

Regards

Andreas

Former Member
0 Kudos

Hello Yarragudi,

Did you find the solution ? I am facing the same issue.

Thanks in advance.

Hi Farouk,

We can create custom fields in smart table.

Please follow the link given by Akhilesh.

sample code: create a table inside smart table like below.

<Table> <columns> <Column width="100px" hAlign="Left"> <customData> <core:CustomData key="p13nData" value='\{"columnKey": "Dmbtr", "maxLength": "5","columnIndex":"4", "leadingProperty": "Dmbtr"}' /> </customData> <Text text="{/#LineItems/Dmbtr/@sap:label}" /> </Column> </columns> <items> <ColumnListItem> <cells> <Text text="{Dmbtr}" /> </cells> </ColumnListItem> </items> </Table>

Regards,

Chandra

former_member227918
Active Contributor
0 Kudos

I think you can define customData for this column and use "enabled" property to input field. check below link if it helps.

https://sapui5.hana.ondemand.com/explored.html#/sample/sap.ui.comp.sample.smarttable.mtableCustom/co...

0 Kudos

Hi Akhilesh,

Thanks for the help. With 'CustomData' we were able to create custom fields in smart table.

former_member227918
Active Contributor
0 Kudos

please mark this as right ans to help others for same issue.