How to scroll to the highlighed row of the table

The steps which i tried was working now after turning off virtualized rows prop but it’s focusing frequently even aftr clicking on text field …it is focusing again and again on the same row

“I suggest you pass the params row[‘Id’] and IdTxt to the view and there, on a custom prop expression struct bound to these values, check if they match.
you might alse have to put a delay in before doing the focus… just to be sure”…
I am not able to understand this above method.

You could send a confirmFocussed message after self.focus() system.perspective.sendMessage("FocusConfirmed")

which the table than listens to and sets a boolean to false

if not confirmed: system.perspective.sendMessage("RowFocus")

Nvm then if the other way works xd

1 Like

I am not getting this one as well…

should I use sendMessage function again on checkbox view script after self.focus() or should I use it in Transform after this line “system.perspective.sendMessage(“RowFocus”)”

and which boolean value to false?

yes

just a custom property which initial value is set so it will tigger the RowFocus.
And after receaving the message "FocusConfirmed" on the table it will be set so it nolonger send the message RowFocus

if not self.props.custom.confirmed: 
  system.perspective.sendMessage("RowFocus")

I'm still confused but tried ..not sure correct or not ..

  1. I added sendMessage function on checkbox view script
    image
  2. The above one getting triggered from Transform code below on main view..
                        returned_rows.append(row_dict)
			system.perspective.sendMessage("RowFocus")
			self.props.selection.selectedRow=-1
  1. created custom prop with boolean value and initial value set as true on main view >root..
    image
  2. on main view > configure script> created msg handler as per below ..which gets triggered from checkbox view
    image

the problem is still not solved...scroll is frequently moving up and down

based on a row number, it can be focused on which one is highlighted?

You gotta put the if here

returned_rows.append(row_dict)
if not self.(...).custom.Confirmed:
  system.perspective.sendMessage("RowFocus")
self.props.selection.selectedRow=-1

And here you just set it false. dont trigger an other message here
self.(...).custom.confirmed = false

1 Like

Thanks for your reply

I tried it but not successful..I set the below custom prop to false but it was not triggering at all so passed value 0 and it passed the value 0 to custom prop

self.view.getChild("root").custom.Confirmed=0
and also passed bool(0) to custom prop..neither way worked

in transform below code added

if self.view.getChild("root").custom.Confirmed==1:
				system.perspective.sendMessage("RowFocus")
			self.props.selection.selectedRow=-1

same issue scroll frequently going up n down

And plz check below link ..will this work In my case? if yes then let me know how to do in perspective

What do you mean? it didnt focus?

1 Like

yes its not focused just row got highlighted and I scrolled down and checked for the same…

No this is a topic from 2009 so its vision

Thats good we are on the right track! make sure this happens again.

now the problem with the srolling is that you let it trigger on every row. so you will have to put an if in there again.

if self.view.params.row= payload['row']]:
  self.focus()

and add the viewparam row on the checkbox view( this one automatically gets filled in by the table)

and change the message send to include the payload
system.perspective.sendMessage("RowFocus", payload={row:row['Id']})

1 Like

image
see above img…the custom prop value not changed to false …after entering text field …the row got highlighted but not focused…

created row param in checkbox view as below…
image

and on checkbox view > message handler >below code written…
image

and this code written on main view table scrip> msg handler to pass the boolean value as false to custom prop of main view which is named as confirmed…
image

and on table data>transform> below code written

returned_rows.append(row_dict)
			if not self.view.custom.confirmed:
				system.perspective.sendMessage("RowFocus", payload={row:row['Id']})
			self.props.selection.selectedRow=-1

I am getting this below error after trying the above steps …

line 4, in onMessageReceived
KeyError: row

Also, I would like to share that by following below steps, It’s triggering only one time focus and then custom property becomes false and if I manually ticked it to true then only it is focusing again and then again becoming false and focus stopped…this actually working but I can’t manually tick the custom property to focus again n again so I made it true on text field onKeyPress event …now its triggering it true and after entering it focusing once and again set false …cycle continues…

steps:

  1. payload removed from checkbox script as well as from transform which initially suggested by you…
  2. on main view > table >msg handler>focusConfirmed>written below code…
self.view.custom.confirmed=bool(0)
self.view.custom.confirmed="false"

  1. then on table transform below code…
returned_rows.append(row_dict)
			if self.view.custom.confirmed==bool(1) or self.view.custom.confirmed=="true":
				system.perspective.sendMessage("RowFocus")

it’s working as expectednow …
Let me test it multiple times and will confirm you
Thanks a lot

ups yea it should be a string, also i guess row[‘id’] doesnt match the data index mb.
try len(returned_rows)-1 instead i guess
system.perspective.sendMessage("RowFocus", payload={"row":(len(returned_rows)-1)})

Thats fine right?

1 Like

No …only the last rows are getting searched/focused properly …starting rows or not … the scroller is moving slowly up after pressing enter on the text field multiple times…

could you get a video of whats happening?

1 Like

now it's working properly after trying out this below one .. :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: Thanks a lot

1 Like

phew :smiley: i bit complicated to make it work without js but glad it works afterall hehe

1 Like

Yoo …thanks a lot :slight_smile: :slight_smile: :slight_smile::+1: :heart_eyes:

1 Like