Page 1 of 1

Nested Data Grid Behaviors

Posted: Mon Jul 30, 2018 4:13 am
by bwmilby
We had a thread going on the Use List about how to get a behavior between the Data Grid group and the DG library. It turns out that the way the library code was written, attempting to do this broke the Data Grid. A bug report was submitted and a fix has been proposed. This is great for those of us who are on LC9, but won't help anyone using LC8 if they would like this behavior. I've posted a demo stack on GitHub that shows you how to do this on either version (and it may work on earlier versions too).

Why? If you wanted to use a behavior to replace or add to an existing DG handler, you would not be able to without this mod. You could always put the code in the DG group itself, but then you would need to duplicate it for each DG that you wanted to use the same code. You could chain it to the end (after the library code), but then it would impact every DG in the app (which may or may not be an issue).

https://github.com/bwmilby/lc-misc/tree ... DGBehavior

Image

The README on GitHub also links to the discussion thread, the PR, and the bug report.

Re: Nested Data Grid Behaviors

Posted: Tue Nov 16, 2021 12:10 am
by Monox18
Hi Brian,

I came across this post today when trying to set up custom DG behaviours. I tested the demo stack and it works well in the IDE. I also compiled to Windows standalone but it doesn't work. I tried as well modifying the behaviorsdatagridbuttonbehavior.livecodescript file in the LC installed folder, so that the preOpenStack code is no longer necessary, but still doesn't work. Maybe there's a proper way of modifying an IDE stack? Any ideas of how to make this work in a Standalone?

I suppose this demo was intended for IDE only, never for standalone, and to be merged. The pull request was never merged and now that they archived the repository it is unlikely that they will merge it... :/

Re: Nested Data Grid Behaviors

Posted: Wed Nov 17, 2021 5:46 am
by bwmilby
I’ve never actually tried to build a stand alone that uses the code, so I’m not positive about the steps. But, if you updated the script in the LC installed on your machine, that same code should be brought into your compiled app. I would need to play with it some.

If it doesn’t make it into version 10, then I could update the stack if needed to keep it working.

Re: Nested Data Grid Behaviors

Posted: Wed Nov 17, 2021 12:17 pm
by Monox18
I gave it a second try today with a fresh mind and quickly fixed it. I noticed your original stack doesn't have the typical "Data Grid Templates 1637146130251" substack autogenerated when dragging a Datagrid for the first time. I deleted your DG, dragged a new one, the substack was generated, put the behavior, compiled again and this time It worked in a Standalone. No need to edit the installed LC stacks. So the preOpenStack code does indeed work in standalones.

Here's the updated one, also saved as the recent LC 9 version.
NestedDGBehavior2.rar
(8.29 KiB) Downloaded 97 times
I never thought I could edit an IDE stack on a preOpenStack. That opens up some possibilities, especially when trying to find a bug workaround. Thanks mate !