Question

Auto select/click the first item in a List View after it's loaded

  • 15 August 2014
  • 4 replies
  • 1352 views

I have a list view which, when an item is clicked, kicks off some other actions on the form.

When the page first loads, the list view is populated, and I'd like to be able to automatically select/click on the first item in the list (without waiting for the user to do that).

 

Is this possible?

 

Thanks in advance.


4 replies

It is not possible out of box.

 

You can do a workaround to get the first row data on page load by calling the smartobject and filter on Rowno , Then based on this data you can exexute other action that you want to kick off on row click.

I realise this is 4 years old but if anyone ends up here, as I did, the following script placed into a literal datalabel will click the first item. Transfer it into the datalabel after the view executes its list method and then clear the label again so you can execute it on refreshes or reloads. 

 

Replace PanelTitle with the view instance name as seen in the Form Designer (Normally 'area item #' by default)

 

 

<script>
$('div[name="PanelTitle"]').find($('td.first'))[0].click();
</script>
Badge +2

Hi Nathan

 

I just found your post and this is exactly what I need (auto select first row in a view)

 

I've implemented as per your note but cant seem to get it working.

Do you need the view to be on a SmartForm? 

for testing I just have a list view called test

 

I've changed the script as below

<script>
$('div[name="test"]').find($('td.first'))[0].click();
</script>

 

I transfer it to a data label after the getlist action

then have a rule to clear it

 

however cant get the first row being selected

any ideas?

 

thanks
Paul

Badge +2
Hi Nathan

Ignore my previous post as I managed to get this working now using your code. I put the view on a form and worked OK. thanks

Reply