Forum Stats

  • 3,817,099 Users
  • 2,259,276 Discussions
  • 7,893,655 Comments

Discussions

user-select on oj-list-view

user10755793
user10755793 Member Posts: 2
edited Feb 12, 2021 11:00AM in Oracle JET

user-select is disabled by default on oj-list-view . How can I turn this ON so that I can copy text from the oj-list-view

Tagged:

Answers

  • Using the ListView Cookbook demo as an example, you can simply add the CSS style on to the span for the text that you want to allow to be selected.


    <oj-list-item-layout>
      <span class="oj-typography-body-md oj-text-color-primary"><oj-bind-text value="[[item.data.name]]"></oj-bind-text></span>
      <oj-avatar slot="leading" size="xs" src="[[item.data.image]]"></oj-avatar> 
      <span style="user-select:text" slot="secondary" class="oj-typography-body-sm oj-text-color-secondary"><oj-bind-text value="[[item.data.title]]"></oj-bind-text></span>
    </oj-list-item-layout>
    

        In the code above, I have made the second span (the employee title) selectable. Note that this is not always a great thing to enable. If you want any kind of Drag and Drop, or swipe behavior on your list items, this will interfere with that. It will also still select the item if you have selection enabled on the listview.