@cmallonee @victordcq I referred to this below link and the given solution worked out but to see the highlighted row in the table sometimes I need to check by scrolling down ..how can I make it top of the list or auto-scroll down to view the highlighted row..?
You would have to move the row it to index 0 i suppose
instead of appending the array use array.insert(0,data)
if ??:
returned_rows.insert(0,row_dict)
else:
returned_rows.append(row_dict)
This one worked out but auto-scroll to show the highlighted row will be the best one as if scrolled down and searched then the highlighted row shows on top…Auto scroll to show the highlighted row is possible?
No sadly its not really possible without javascript.
ok fine. Thanks a lot for your help
by following this step to highlight the row…the dataset got converted into an array of data as below:
and onRowClick event , I am using below code
value=self.props.data.getValueAt(self.props.selection.selectedRow, 'Id') system.perspective.print(value)
I am getting an error:
object has no attribute 'getValueAt'
how to get the selectedrow in case of data array…pls help @victordcq
try
value=self.props.data[self.props.selection.selectedRow]['Id']
or
value=self.props.data[self.props.selection.selectedRow].Id
Thanks a lot
@victordcq @cmallonee @pascal.fragnoud ...I am getting output in the console as object wrapper as below while clicking on Row and only for highlighted row ...for an unhighlighted row, I am getting proper output means the only value of ID as 101...I want the same output for highlighted one also, how to achieve that?
<ObjectWrapper>: {u'style': {u'backgroundColor': u'#AAAAAA'}, u'value': u'101'}
using value, at last, I got proper output for a highlighted row but for an unhighlighted row, it's throwing below error
value=self.props.data[self.props.selection.selectedRow]['Id'].value
error........
unicode' object has no attribute 'value'
by clicking on a row, I need proper value for both highlighted and unhighlighted rows..plz help
Solved it ...Thanks!!
to highlight the row, I followed as given in this below link...
Here, in below code I edited from ..
if str(row['Id'])== IdTxt:
row_dict['Id] = {'value': row['Id'], 'style': {'backgroundColor': backgroundColor}}
returned_rows.insert(0,row_dict)
self.props.selection.selectedRow=-1
else:
row_dict['Id'] = row['Id']
returned_rows.append(row_dict)
To ..Final code
if str(row['Id'])==IdTxt:
row_dict['Id'] = {'value': row['Id'], 'style': {'backgroundColor': backgroundColor}}
returned_rows.insert(0,row_dict)
self.props.selection.selectedRow=-1
else:
row_dict['Id'] = {'value': row['Id']}
returned_rows.append(row_dict)
Just added value in else condition that worked out for me and now getting proper ID value on both highlighted and unhighlighted rows..Hope this helps.
Thank you!
Don’t delete your posts when you find the solution, instead explain what you did to solve your issue.
It might help other people who have the same problem.
the table row will get highlighted based on text in the text field but it is case sensitive unlike filter table search …is there any solution for this? @victordcq
It’s awkward to type ID in caps and search so plz help
Use 'some_string'.lower()
everywhere you’re comparing strings.
If you use weird characters, though you might first want to do an upper too
"ß".lower() == "SS".lower()
#>>> false
"ß".upper().lower() == "SS".upper().lower()
#>>> true
Thank u
Thank u
ignition doesn’t support javascript for auto scroll to show the highlighted row?
Only if you make your own component, you have acces to javascript.
In the designer there is only jython (java+python)
…
What you maybe can try tho (but idk if it will work is) is give every row an extra column with an embedded view and in that view trigger a self.focus() on something. (based on the condition)
self.focus() should also cause a scroll to happen, atleast it does in the view idk if it also will do that in a table. But i think it should work
I tried this way …but not sure that followed as per your reply…below the steps which I tried…
- checkbox view created then added one more col and changed render as view and selected viewpath as “checkbox view”.
- checkbox view >scripts>message handler>below focus code written…
- Added the below sendMessage line in add transform …
if str(row['Id'].lower())== IdTxt:
row_dict['Id'] = {'value': row['Id'], 'style': {'backgroundColor': backgroundColor}}
system.perspective.sendMessage("RowFocus")
else:
row_dict['Id'] = {'value': row['Id']}
returned_rows.append(row_dict)
This trial not worked …I understood wrongly ? plz clarify and help
Yeah it wont work like this while you are making the columns still, becuase the rows havent been made yet. Dont work with messages for this one as they might get send and not recieved if the row isnt loaded yet.
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
And turn off virtualized rows prop