Disable Selected Records in PICK Query

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
customaware
Posts: 2409
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Disable Selected Records in PICK Query

Post by customaware »

Here is the scenario... Hoping someone might know the script to solve this....

I am doing a PICK ONE OR MORE and Aware Displays a Query with the Checkboxes for each Record down the left hand side of the Query.

I definitely want to user to see all of the records to pick from. However, based on the value of a particular Attribute in that BO, I want
to disable the Checkbox on that row and disable the Row from being able to be selected based on a Condition.

We already have something similar... A few years ago... we have a Query that has an Expansion option on it that shows Child Records. We only wanted to show the Expansion Triangle to the Left if the Parent actually had any Child Records. This works great.

Code: Select all

config.dataBound = function (e) {
   var items = e.sender.items ();
   items.each (function () {
      var row = $(this);
      var dataItem = e.sender.dataItem (row);
      if (dataItem.get ("CountChild") == 0) {
         row.find (".k-hierarchy-cell").html ("");
      }
  });
  parser.afterStoreLoad.call (parser);
};
So, I think we can adapt it to not display the Checkbox... Haven't got there yet but I think we are close..... But we don't know how to disable being able to click on the Row which then gets Selected.

Anyone got any idea how to accomplish this please?
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
customaware
Posts: 2409
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Disable Selected Records in PICK Query - SOLVED

Post by customaware »

Wow! Chat-GPT to the rescue...

Challenge Solved!

DM me if you want to know how.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
hpl123
Posts: 2604
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Disable Selected Records in PICK Query - SOLVED

Post by hpl123 »

customaware wrote: Thu Apr 25, 2024 1:27 am Wow! Chat-GPT to the rescue...

Challenge Solved!

DM me if you want to know how.
Sounds interesting, how about sharing some details here?
Henrik (V8 Developer Ed. - Windows)
customaware
Posts: 2409
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Disable Selected Records in PICK Query

Post by customaware »

Try this prompt in Chat GPT 4

I am using the Kendo UI Library...
The Grid Control allows you to select a data row in the Grid by clicking a Checkbox.
Write me the code necessary to only show a selection Checkbox and only allow the row to be selected by clicking on it based on a condition. In this instance, I have a Variable called rowCanBeSelected. If rowCanBeSelected == True then show the Checkbox and allow the Row to be selected by clicking on it. If rowCanBeSelected == False, then do not show the Checkbox and do not allow the Row to be selected by clicking on it.

Way Cool!..... Not the perfect configuration for Aware but all the necessary needed parts are provided.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
hpl123
Posts: 2604
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Disable Selected Records in PICK Query

Post by hpl123 »

:)
customaware wrote: Thu Apr 25, 2024 11:49 pm Try this prompt in Chat GPT 4

I am using the Kendo UI Library...
The Grid Control allows you to select a data row in the Grid by clicking a Checkbox.
Write me the code necessary to only show a selection Checkbox and only allow the row to be selected by clicking on it based on a condition. In this instance, I have a Variable called rowCanBeSelected. If rowCanBeSelected == True then show the Checkbox and allow the Row to be selected by clicking on it. If rowCanBeSelected == False, then do not show the Checkbox and do not allow the Row to be selected by clicking on it.

Way Cool!..... Not the perfect configuration for Aware but all the necessary needed parts are provided.
Brilliant, we should have a Chat GPT integration in Aware. How does one access Chat GPT now? Something on your own server or using some third party service?
Henrik (V8 Developer Ed. - Windows)
customaware
Posts: 2409
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Disable Selected Records in PICK Query

Post by customaware »

I use Chat GPT https://chat.openai.com/ and Grok on X quite extensively but have found Chat GPT much better for solving coding issues.... It is really really good at SQL, html, css and js stuff.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
hpl123
Posts: 2604
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Disable Selected Records in PICK Query

Post by hpl123 »

customaware wrote: Fri Apr 26, 2024 5:46 am I use Chat GPT https://chat.openai.com/ and Grok on X quite extensively but have found Chat GPT much better for solving coding issues.... It is really really good at SQL, html, css and js stuff.
Nice, will be fun to play with :).
Henrik (V8 Developer Ed. - Windows)
Jaymer
Posts: 2461
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Disable Selected Records in PICK Query

Post by Jaymer »

customaware wrote: Thu Apr 25, 2024 11:49 pm
Way Cool!..... Not the perfect configuration for Aware but all the necessary needed parts are provided.
Well, did you get this working?
I would disagree that “all the necessary needed parts are provided “ unless you were able to modify the template.
Normally in aware, we end up modifying the HTML that was created in the render script.
What this example does is put a conditional statement in the template, which is something Vlad would do on his end, and when the item isn’t supposed to have a checkbox, then that function just doesn’t put that HTML code in. Voila, no checkbox.

But in aware, we would have to search through each grid line and eliminate the checkbox/disable it after the fact.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
ACDC
Posts: 1143
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: Disable Selected Records in PICK Query

Post by ACDC »

I would disagree that “all the necessary needed parts are provided “ unless you were able to modify the template.
Normally in aware, we end up modifying the HTML that was created in the render script.
What this example does is put a conditional statement in the template, which is something Vlad would do on his end, and when the item isn’t supposed to have a checkbox, then that function just doesn’t put that HTML code in. Voila, no checkbox.

But in aware, we would have to search through each grid line and eliminate the checkbox/disable it after the fact.

While AI knows the Kendo setup pretty well, it doesn't know AwareIM and whats needed to provide an AwareIm solution. ChatGpt needs to be trained on the inner workings of AwareIm and its voodoo scripting requirements. That's why a built-in AI Co-Pilot equivalent in the configurator is needed.. it would be a game changer
hpl123
Posts: 2604
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Disable Selected Records in PICK Query

Post by hpl123 »

ACDC wrote: Sat Apr 27, 2024 9:58 pm
I would disagree that “all the necessary needed parts are provided “ unless you were able to modify the template.
Normally in aware, we end up modifying the HTML that was created in the render script.
What this example does is put a conditional statement in the template, which is something Vlad would do on his end, and when the item isn’t supposed to have a checkbox, then that function just doesn’t put that HTML code in. Voila, no checkbox.

But in aware, we would have to search through each grid line and eliminate the checkbox/disable it after the fact.

While AI knows the Kendo setup pretty well, it doesn't know AwareIM and whats needed to provide an AwareIm solution. ChatGpt needs to be trained on the inner workings of AwareIm and its voodoo scripting requirements. That's why a built-in AI Co-Pilot equivalent in the configurator is needed.. it would be a game changer
1+ and the custom Aware AI should be trained in all things AwareIM, Tomcat, databases, java, javascript etc. i.e all technologies AwareIM is built on. Then we would have real power to get "help" with anything in terms of using, configing and extending AwareIM.
Henrik (V8 Developer Ed. - Windows)
Jaymer
Posts: 2461
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Disable Selected Records in PICK Query

Post by Jaymer »

OK, I’m not so big on the AI integration part, because unless I’m wrong, chat GPT doesn’t write anything new… There is nothing new under the sun they say… It’s just finding a script out of the 10,000s it’s already been trained on and it’s just repeating an article for you. That’s what I thought it does.
But I may be wrong on that certainly.

That may be a big mountain for Vlad to climb.

But the solution shown here was because of a condition on the template.
Maybe all that’s needed to do similar things is modification of the template inside aware.


There’s plenty of examples from thousands of other people who write lower level languages and use Kindle. All of them have to do a template. You don’t need AI to be tuned to aware if we had to optionally know the ends and outs of making a template to go to the next level.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
hpl123
Posts: 2604
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Disable Selected Records in PICK Query

Post by hpl123 »

Jaymer wrote: Sun Apr 28, 2024 1:51 am OK, I’m not so big on the AI integration part, because unless I’m wrong, chat GPT doesn’t write anything new… There is nothing new under the sun they say… It’s just finding a script out of the 10,000s it’s already been trained on and it’s just repeating an article for you. That’s what I thought it does.
But I may be wrong on that certainly.

That may be a big mountain for Vlad to climb.

But the solution shown here was because of a condition on the template.
Maybe all that’s needed to do similar things is modification of the template inside aware.


There’s plenty of examples from thousands of other people who write lower level languages and use Kindle. All of them have to do a template. You don’t need AI to be tuned to aware if we had to optionally know the ends and outs of making a template to go to the next level.
I don´t know much about AI etc. but the way I envision this could work is like I wrote above, the AI being a smart knowledgebase of sorts (with the key point being it being a knowledgebase about all things AwareIM) that can provide answers and things like scripts and even automatic config of things like queries etc. etc.. Imagine if you want to do some custom JS script, we could ask the AI in some English language type way to do what we want e.g "how do I change the KendoUI group template to include number of instances found in grouping" or it could even help with things like Java e.g if the AI knew Java and the inner workings of AwareIM, we could ask the AI to "write" plugins for us e.g "how do I change a string to x y and z" and the AI then spit out the code or even the finished custom Java plugin files etc. etc.. It could also help config things like REST apis e.g ask it "how do I retrieve x data from xero" and the AI config that automatically. Even things related to Tomcat could be included e.g ask the AI "how do I set the Tomcat timeout per user" etc.. The options could be endless. If this whole thing and type of AI functionality is realistic and achievable is another thing but Vlad is the man so I am sure he can whip up something if that is the way he/Awaresoft chooses to go. It is the future at least I think.
Last edited by hpl123 on Mon Apr 29, 2024 8:03 am, edited 1 time in total.
Henrik (V8 Developer Ed. - Windows)
hpl123
Posts: 2604
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Disable Selected Records in PICK Query

Post by hpl123 »

Jaymer wrote: Sat Apr 27, 2024 4:19 pm
customaware wrote: Thu Apr 25, 2024 11:49 pm
Way Cool!..... Not the perfect configuration for Aware but all the necessary needed parts are provided.
Well, did you get this working?
I would disagree that “all the necessary needed parts are provided “ unless you were able to modify the template.
Normally in aware, we end up modifying the HTML that was created in the render script.
What this example does is put a conditional statement in the template, which is something Vlad would do on his end, and when the item isn’t supposed to have a checkbox, then that function just doesn’t put that HTML code in. Voila, no checkbox.

But in aware, we would have to search through each grid line and eliminate the checkbox/disable it after the fact.
Not necessarily, that is why we have both an initialization script and a render script. If we add an initialization script, we interject changes BEFORE Aware actually "construct" the thing whatever it is i.e if someone (or an AI) knew all options available via initialization scripts (and more), we would ALMOST be a full fledged developer sitting and "writing" KendoUI code (or whatever other part of Aware) i.e we get more advanced customization options. One of the things I find difficult in Aware and I think many share this, is that it is so complex and so many different technologies and I am not just talking KendoUI and exactly how that works and is implemented in Aware but all things in Aware. I have spent thousands of hours tinkering with AwareIMs more "complex" options e.g scripts and custom changes to things like CSS, Java, Tomcat etc. etc. and it is a bit of a mess and a black box (understandable considering AwareIM is a "combination" package of many different technologies) and still to this day, I find it very difficult as soon as I want to do some custom things and the problem is multifaceted e.g lack of knowledge and documentation but also it has a lot to do with AwareIM again being such a complex package of stuff. AwareIM has IMO always been a tool targeted at 2 different users, the GUI user and the more advanced developer i.e the GUI user just use the config tool to build apps (and with that one can build a lot) and some users like myself want more advanced options e.g the way I think these days is, "I want to do x, how can I do that in Aware" and then I dig into tinkering because really, most if not all things are possible in Aware since it is completely "open" to changes and extending. When I first started using Aware, I thought more in the lines of "I want to do x, is that possible in the Aware GUI and if not what is the next best thing" i.e a lot less options to do what one wants. I say more more more customizations options (but keep the GUI parts) and I think this is Awaresofts strategy now and going forward but I could be wrong. My point being (and connecting this to my post above), having more tools that help us with the advanced customization things e.g an Aware AI would be very powerful.
Henrik (V8 Developer Ed. - Windows)
customaware
Posts: 2409
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Disable Selected Records in PICK Query

Post by customaware »

Have done a small demo for both Conditional Expansion and Conditional PICK in the Tips and Tricks area.

https://www.awareim.com/forum/viewtopic ... 795#p59795
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
hpl123
Posts: 2604
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Disable Selected Records in PICK Query

Post by hpl123 »

Talking about AI and having it trained to support users of a particular software solution, here is another similar example and the suggestion here is similar to the one above and in other discussions in the forum i.e a "help" AI that helps with all things x. Now this product TheBrain is obviously not a software development tool like AwareIM but many of the same "issues" are still there and many of the same "solutions" would be the same e.g AI that help the user do things and get knowledge about things.

https://forums.thebrain.com/post/brainc ... 5?trail=15

TheBrain already has a ChatGPT integration that works quite well actually so is another tip if someone wants to play around with AI. The AI in TheBrain can be asked primarily to generate mindmap structures and notes e.g ask it who George Washington was and you will get an "article" note about it or you will get a mindmap of his biography and life etc. etc..

Here you can read about the ChatGPT AI in TheBrain: https://www.thebrain.com/ai

PS: The ChatGPT in TheBrain can also be used for KendoUI scripts and things like that. Here is for example the note I got in my TheBrain when I asked it for "Select row in Kendo UI":

Code: Select all

Achieving Row Selection in Kendo UI Grid

In Kendo UI, the Grid component is a powerful tool for displaying tabular data with rich features. One common requirement in web applications is to allow users to select rows in a grid for various purposes such as viewing details, editing, or deleting data. Fortunately, Kendo UI provides easy-to-use functionality to enable row selection in the Grid component.

## Enabling Row Selection

To enable row selection in a Kendo UI Grid, you need to set the `selectable` property to `true`. This property determines whether users can select rows in the grid. By default, row selection is disabled, so you must explicitly enable it by setting `selectable: true` in the Grid configuration.
javascript
$("#grid").kendoGrid({
    selectable: true,
    // other configuration options
});
```

Once you have enabled row selection, users can click on a row in the Grid to select it. By default, users can select a single row at a time. However, you can customize the selection mode to allow multiple rows to be selected simultaneously.

## Customizing Row Selection

### Multiple Row Selection

To enable multiple row selection in a Kendo UI Grid, you can set the `selectable` property to `'multiple'`. This allows users to select multiple rows by holding down the Ctrl key while clicking on rows.
javascript
$("#grid").kendoGrid({
    selectable: 'multiple',
    // other configuration options
});
```

In addition to selecting multiple rows manually, you can also provide checkboxes in each row to allow users to select rows more conveniently. This can be achieved by setting the `checkboxes` property to `true`.
javascript
$("#grid").kendoGrid({
    selectable: 'multiple, checkboxes: true',
    // other configuration options
});
```

### Selectable Row Events

Kendo UI Grid provides events that you can hook into to perform actions when rows are selected or deselected. You can use the `change` event to handle row selection changes. The event handler receives the selected rows as an argument, allowing you to access the data associated with the selected rows.
javascript
$("#grid").kendoGrid({
    selectable: true,
    change: function(e) {
        var selectedRows = this.select();
        selectedRows.each(function(index, row) {
            var dataItem = $("#grid").data("kendoGrid").dataItem(row);
            // perform actions with the selected data item
        });
    },
    // other configuration options
});
```

By utilizing the `change` event, you can update the UI, trigger actions, or perform any custom logic based on the selected rows in the Grid.

## Conclusion

Enabling row selection in a Kendo UI Grid is a fundamental feature that enhances user interaction and enables various functionalities in web applications. By following the guidelines provided in this note, you can easily implement row selection and customize the behavior to suit your application's requirements. Whether you need to enable single row selection or allow users to select multiple rows with checkboxes, Kendo UI offers the flexibility and functionality to achieve your desired behavior efficiently.
Henrik (V8 Developer Ed. - Windows)
Post Reply