[Feature-789] Perspective component extensibility

Being new to web dev, this may be a dumb question…

In Vision, I’m able to hack around and break change things in a given component to better suit my needs. For example, allow the dropdown component to support disabling items and increasing the touch area heights of the items.

Can we do this in perspective components? And if so, how? Do you have any examples?

Thanks!

1 Like

Basically, no. A deliberate design decision was made early in Perspective’s development to not allow arbitrary Javascript to be written by someone in the designer - which would be your way to access “internals” like you can in Java Swing (caveat: not really, because React is in the way, but basically).

On the plus side, adding an external component to Perspective is, generally, easier than Vision - personally, I’d like to add some kind of easy builder that handles the (minimal) Java portions required and makes it easier for front-end-ey folks to just supply their own JS code much more easily.

2 Likes

Hmm, one of the things I like most about Vision is the fact that you can change things if you don’t like them, or need them to be different. I have used Perspective a little bit, and this lack of extensibility really stuck out to me as a sore thumb that was missing compared with Vision. I’m not a web programmer so I don’t know javascript :frowning: but I guess I didn’t know any Java or Python before I started using Ignition either. It still will be far more work to create your own components in Perspective with slight modifications to existing components, than it is in Vision to do the same which is a bit disappointing

1 Like

Well, the other end of things is that generally, what people are after with deeply complex Vision scripts is the ability to customize appearance - which is instantly easier in a web context thanks to CSS. With better support for custom themes on the way, it’s only going to get better - even over and above style classes, you’ll be able to provide a custom theme that automatically styles your entire project - and CSS can do customization far beyond just coloring elements.

For the other things, such as customizing behavior, yes, there are limitations - you aren’t able to totally customize things as you can in Vision - but, also keep in mind that Perspective/8.0 hasn’t even been out for a year, compared to Vision’s ~decade lifespan. If things go according to plan, we’ll soon have first-party components or combinations of settings that cover 99% of the functionality you would want to customize - and then for those rare exceptions, custom modules are still available to you.

And, for what it’s worth, if you know Python, JS isn’t a far leap - or, if you want a really nice experience, you can develop with TypeScript (which we use in Perspective) - it’s the dynamic nature of Python, but with many of the advantages of a strong type system like Java has.

2 Likes

Out of interest, would something like moving the scrollbar of a table/flex repeater component to a specific location be possible in Perspective? Or is this something that would need a component change?

(Ignition - Table Component: Scroll Bar Hide & Selected Row)

We would probably have to expose an internal like https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView via a scripting method - first on components directly, then for something like the table it would have to have an ability to pass a specific row ID or something similar. That’s a decent feature request, though - I’ll file an internal ticket :slight_smile:

1 Like

Cheers! As you probably read, I use it in Vision to keep the active sequence step in a list of steps always visible. It’s super handy for an operator :slight_smile: I can see it being useful for other things as well though

I’m looking to do exactly the same as Nick, to keep the active row in a perspective table in view. Has the ‘scrollIntoView’ been implemented?

I just pulled this ticket back in to be evaluated and re-prioritized. Not sure when this would be planned or implemented at this point though.

Checking back in here… any update on this scrollbar idea?

It’s a low priority ‘feature’ in our backlog, and we tend to prioritize features below bug fixes, since more features inevitably means more bugs.

1 Like

Hey guys, any update on this? It has been a while and it is an important feature for us.
Thanks!

1 Like

Bump for jumping to selection in table

Please make this happen!

@victordcq one more for you, Victor, if you get a chance at some stage :grimacing: I'll give it a crack in the meantime if I get a chance!

document.querySelector('[data-row-id="22"]').scrollIntoView()

quite easy if you have virtualized rows off. if not will be a bit harder. well asuming the table gets loaded in fast enough.

i can make something better, but dont have time right now

Now that the pandora-markdown box is open, how about making js injection a bit... cleaner ?

eh, there is no way to do this clean, safe and easily for someone who doesnt know js.

But at the moment, when they do need js, they come to the forum and end up hacking the markdown component. That can't be a good solution.
And for those who know js, they still have to go through hoops.
That there is no built-in way is not stopping anyone, it just makes it ugly.

1 Like

i mean you could call it a js component, but it would look just the same tbh.
it would both be text to html, and would require onload hacks, unless perspective does some things around it for only js onload, but that would limit the flexibility.