Functionality question, clicking on a row in a table in perspective to pull up another view

What is the best practice for letting users click on tables to direct them to pages with relevant data from the row in that table which they clicked on?

Do you have a mouse up event and then run a script to detect the selected row?
Or would the event happen before the select has occurred?

I am going to test it, but I thought if someone has done this, they might have pointers or tips on pitfalls and best practices.

The first element each row has a link as well.
That is a first for me to see as well, at least a first to see through the lens of design.

Background
I thought that in a software I see used, I don't want to name that software, there is a function where the users can click a row in a table and that will take them to a page of data related.

I think the table component that software uses is kind of similar to Ignition, and I wanted to make that functionality in my Ignition project.

If the data is coming from a database query then just pass the database row id or unique key to the new view and use it on a query there.

1 Like

I mean what is the best way to pass this information of which row and send the user to another page with data from that page.

I think you are saying like just do this thing that I am asking about which way to do.

Do you use a configured event on the table, and then run a script?
Or on row click?

The easiest way is probably with a click event on the table. The event object passed to that function should have a row property if I remember correctly.
From there, all you have to do is navigate to a page/view or open a popup, and pass them the data you want.

1 Like

oh if you do a script, you can get the value (dict): the row's value as a JSON object.

I think I am getting an idea of some ways to do it.

I think when I usually switch pages, I use like onMouseUp then I use navigation action, and set one of the page opens.

  • Configure an Event for your table component.
  • use the Component Events/onRowClick instead of Mouse Events/onMouseUp. Configure the event to execute a script.
  • you can retrieve values from the row using the method event.value["column name"] and pass them as parameters to your page.
2 Likes

@zacharyw.larson,
You have a nice "selection" object in the table props where you'll find everything you need (selectedColumn, selectedRow, the dataset in json format, etc.)
One of the beauty of Ignition, is that you build the component you need and the reuse it. You're not tied to a component, designed by someone, with limited features (or at least features that the developper wanted to develop). Et même, une fois qu'il vous plait, vous pouvez le partager sur eXchange!
BTW, I'm interested in knowing the software package you are talking about. Good to know what's good and what's wrong :wink:

1 Like

Thanks for helping me.

It isn't a matter of being wrong or right. It is more a matter of monthly fees vs Ignition's one-time fees.

There are many packages that companies can use to implement features like dispatching or scheduling.
If we can use just Ignition though, I think that is best.

1 Like

system.nav.openWindow( "ValveSetPts" , { "valveNum" : 3 , "titleText" :titleText})

Does this example mean I don't need to have the URL setup with colons and the parameters in the URL?


Because I was doing this:

image

All of system.nav.* is Vision-only. Along with system.gui.*.

Any time the documentation refers to windows and templates, it's Vision. When it refers to pages and views, it's Perspective.

2 Likes

How do I open a window in Perspective from a scripted event?

Everything related to perspective is under system.perspective.* system.perspective - Ignition User Manual 8.1 - Ignition Documentation

1 Like

You don't. Perspective doesn't have windows. It has pages and views.

1 Like

Thanks

Just got there.

# Navigating to a new view. Again, we need to use a keyword argument. We are passing in two parameters, called "myParam" and "myParam2".

system.perspective.navigate(view = 'folder/myView' , params = { 'myParam' : 1 , 'myParam2' : 'Test' })


I can navigate to a view and push the parameters.

I want to change the url and push the parameters though, not the view. Well at least I think I do.
Maybe it is best to not change the URL, but then I think some users might be confused about where they actually are.

1 Like

Changes views correctly, but the table receives a string instead of a datetime.

If I try to use system.date.parse() I get an unable to parse with "1666263180803"
If I use theDate as a datetime instead of a string, the table again doesn't populate.

Table parameters look at the view paraemters.


test=datetime.fromtimestamp(event.value["Date"]/1000)

image

  1. Don't use Python's datetime, anywhere.
  2. Don't use string-formatting of a date for anything other than presentation.
  3. The types you pass into most things in Perspective must be JSON-representable. Dates directly happen to not work here. The lossless form of a java.util.Date object is the epoch-millis it contains. Use system.date.toMillis() and system.date.fromMillis() to convert back and forth between a true Date object and the long-integer milliseconds.
5 Likes

Thanks PGriffith

This was working and I didn't know it.
Just machine 3 didn't have data on that date.


Had to write a dictionary, change a big query, but now I can click a row and bring up a view with those parameters.

Thanks very much for the help.

Ah, I need to switch the URL.

There is no way to keep the URL without the parameters though?

Can I get an example of a multi parameter URL?

I don't understand this:

# Navigating to a perspective page with url parameters.
system.perspective.navigate(url='http://<GatewayIP>:<port>/data/perspective/client/<projectName>/view?key=8')

If I don't change the URL, the performance page on my gateway shows teal from top to bottom for waiting memory.
I am not sure if it means anything bad, but it doesn't look good for sure.

Why is it that you're not using a Popup View, and are instead navigating to a new view?

1 Like

I don't like popup views, and the page I show is best shown full screen.


I might open a new tab instead of just change the URL, but I am not sure yet. I really like the back and forward buttons on the mouse working with the address.

Would you show me an example of a multi parameter URL?

Or could you breakdown that last bit about the view?key=8')

I am not really sure how it works.

I thought maybe for me it would be like /devzl7?which=test?when=date