Seal Report Forum
»
Report Edition
»
Reports
»
'Select All' for dynamic enumerated lists
Rank: Advanced Member
Groups: Registered
Joined: 5/18/2018(UTC) Posts: 40
Thanks: 2 times
|
Is there a way to force a 'select all' for an enumerated list that is dynamically built from a database table?
If I set up a restriction and it is set for 'select all', but more records come in, the ones that were selected stay selected, but any new ones aren't added.
What I'm trying to do is default to 'select all', but allow the users to deselect options if they want to.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Yes there is no direct option to do that (could be an option...) However, as often, you can do it easily in JavaScript: Select your root View, and set the property: 'Additional Javascript' Code:$(document).ready(function () {
$("#0_Option_Value").selectpicker('selectAll');
});
This will do the job assuming it is the first restriction (index = 0), just change the index to match your restriction number.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 5/18/2018(UTC) Posts: 40
Thanks: 2 times
|
I'll give that a shot. Can this option be thrown on the project backlog? Edited by user Thursday, January 17, 2019 8:12:36 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Ok, we added it in the TODO list...
|
|
|
|
Rank: Member
Groups: Registered
Joined: 4/7/2019(UTC) Posts: 24 Thanks: 7 times
|
Hello. Yes, it would be very useful. We're in the same situation with diferente dynamic enumerated restrictions. The solution you suggest to workaround is not completelly functional because the javascript is not executed at the initialization of the report, but it's run with every execution, so all the values are always selected when the user executes the report and then you can not deselect values of the combo. Thanks. Edited by user Friday, January 17, 2020 9:01:20 AM(UTC)
| Reason: The javascript workaround is not functional.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Yes, here is the update, you have to test a JS flag to do it only for the first execution: Code:$(document).ready(function () {
if (!isExecuting) {
$("#0_Option_Value").selectpicker('selectAll');
}
});
|
1 user thanked epf for this useful post.
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
As you mentioned, in your email, the JavaScript method does not work if you force the execution, thus, another way to do it is to use the 'Report Execution Init Script': Code:
@{
Report report = Model;
ReportExecutionLog log = report;
//Script executed when the report is initialized
log.LogMessage("Executing Init Script");
var restr = report.Models[0].Restrictions[0];
restr.EnumValues.Clear();
foreach (var ev in restr.EnumRE.Values) {
restr.EnumValues.Add(ev.Id);
}
}
This is probably safer than JavaScript and works in all cases...
|
|
|
|
Seal Report Forum
»
Report Edition
»
Reports
»
'Select All' for dynamic enumerated lists
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.