"Dynamics Nav 2017" Why cant you set the visibility of fields on a card? - dynamics-nav

As far as I know, one can use the visibility attribute of fields on a card page, but they dont work. Why is that?
It is possible to use the attribute for page-parts and for groups, but not for fields no matter if they are inside a group or just on the page.
page card with tests in editor
page with bool Show1 = true
page with bool Show2 = true
I have the boolean Show1 and Show2 (with the attribute IncludeInDataset = TRUE). Depending on the record, either Show1 is TRUE and Show2 False or the opposite.
(In picture 1:) this works for the group. It and all the fields in it are only visible when Show1 is TRUE.
(In picture 2,3:) It works for parts. The page parts are only visible when the boolean in their visibility attribute is TRUE.
(In picture 4:) Only showing the code works on the page.
(In picture 5:) If I set the visibility attribute to a variable, the field isn't visibly regardless of whether the variable is TRUE or FALSE.
I know I can still manage the effect of dynamically showing fields by copying the whole group in which the field exists without the specific field, and then hiding and showing the 2 groups to simulate hiding and showing the field. Still, I ask myself, why this workaround needs to be used and thought that someone here at stack-overflow might know.
Is it because of a technical limitation or is there some other reason?

The group is the parental element of the field. When you set the visibilty to false for the group, this property is also applied to the fields in that group.
The other way around, if you set the visibility to true for the group you can hide spicific fields inside that group.
This has something to do with the rendering Dynamics NAV does in the background.
By rendering I mean the application's windows size etc.
But since Dynamics NAV is a blackbox in cases like this I can't tell you more.

It seems like NAV does not care much about the visibility setting on field level. At least not for dynamic purposes.
If i need to dynamically hide fields i always put that field in an extra group and set the visibility on that group. If you do not specify any name or caption on this extra group it wont be visible at all.

Related

PowerBI: Giving users the option to include or exclude a type of data

I'm creating my first PowerBI report, analysing staff absence data. The data contains a field of 'Absence Type', which categorises the type of absence the each record refers to.
I would like my users to be able to view my report both with and without the Absence Type of 'Pandemic'. I can hard-filter this on all pages by Excluding it but that gives the users no control.
I thought about using a slicer with a new custom column but I think that would be too confusing. If the column put a 'Yes' or 'No' as to whether the Absence Type was 'Pandemic', that would allow users to view the data without 'Pandemic' entries or just the 'Pandemic' entiries, but give no combined option. Even with a multiselect slicer they could easily deselect everything and see no results at all.
Ideally what I need is either an 'Include Pandemic?' slider where they can choose Yes or No (with Yes being everything and No being everything minus Pandemic records) or a button they can click to toggle the Pandemic records in or out of the visuals.
Apologies if this is has an obvious answer, I'm pioneering PowerBI for my organisation so don't really have anyone to ask here!
There's a way to do this, but it's a bit painful. So you'll want to consider just putting a slicer on AbsenseType and letting the user figure it out.
The extensibility point you can use here is Buttons and Bookmarks.
You can create two buttons, each associated with a Bookmark. Each bookmark can activate set of filters, so one can exclude pandemic AbsenseType and the other can include it. Bookmarks can also toggle the visibility of visuals (see eg here). So when the "ExcludePandemic" bookmark is active, the appropriate filter is active, and the "Include Pandemic" button is visible. When the "IncludePandemic" bookmark is active, the "Exclude Pandemic" button is visible.
In my opinion, the best solution would be tocreate a custom column that will have 2 values:
Pandemic - if the type is Pandemic
Non Pandemic - if the type is different than pandemic
You would then use this new column + Absence Type as a hierarchical slicer.
This would give the user the abilty to pick and choose between:
Select all (If the user deselects everything a select all will also be applied)
Non pandemic only
Pandemic only
Any one or more absence type

Dynamic radio/checkbox solution in Aurelia

I have a gist demonstrating my problem here:
https://gist.run/?id=e2ccd5925e383f2fc36ad277c31bcf23
The checkbox version works fine, if you remove a check, it updates the model right, but if you change the selected radio button, it will keep the true value on the radio that got it's selection removed. If I remove the model.bind="true" value, it will write "on" instead of true. I do want true/false, and not on/off.
I want the object to get it's property updated to be a true or false depending on if it's chosen or not, dynamically. In my scenario I don't know how many radio buttons or checkboxes will need to be selected. I only know that in the cases of it not being a collection, I only want one, and in the case that it is a collection, I want an unknown number selected.
Like the other answer mentions - <input type="checkbox"> behavior is different from <input type="radio">.
I have forked your gist and made the following changes to make your scenario with the radio button work in aurelia:
1) Added a function to the first object in your params collection called selectedChanged(it doesn't have to be there, could be on the viewmodel class instead, perhaps a better place for it). It is responsible for handling selection change in the radio button group, specifically it will iterate over a collection of options (second parameter), and set selected property to true on the option who's id matches the first parameter of the function, and to false on all other options.
2) There is an event on the input called change, I delegate it to a function called selectedChanged mentioned above, passing the option.id value and options as parameters.
https://gist.run/?id=5f38414fde799dfc145fc1291d9f2fd3&sha=f12283b08bfb45e77b8280d46a3709b6ccb82768
I think what you want to achieve (turning individual value on/off) is not achievable with radio, as the way it works (select a single value out of a set) is different with check-box (turning individual value on/off) (MDN reference). So If you truly want to have radio like appearance, with check-box behavior, consider employing some CSS and extra DOM elements to make it look like so, and behave like so.

ag-grid : show the hidden columns (that were dragged out)

I have an ag-grid (free reactjs version) with lots of columns and records to load.
Some columns are not necessary, so the user can drag the columns out of the grid (and hence hide them). This is fine but how can the user show the hidden columns again without refreshing the page?
I don't want to suppress column drag, just a way to undo the hide without refreshing.
Any advice?
Shameless plug: The enterprise version has this feature in two places, Tool Panel and Column Menu.
However, thankfully it is rather easy to implement this feature yourself using a single columnApi call, well... one of these:
resetColumnState()
This will reset the state of the columns to what you initially defined them as. It will basically make everything visible again
setColumnVisible(colKey, visible)
Just pass in the colId of the column (usually what you passed in as 'field'... but it could be different depending on your set up) and a truthy or falsey value and this will show/hide the column
setColumnsVisible(<Array> colKeys, visible)
note the s - other than that it is the same as before, but you provide an array of colKeys that you want to all be hidden or shown. If you wanted to provide an array of all your columns with another array of whether they should be shown or not then use the last option here setColumnState
setColumnState(<Array> columnState)
This is probably overkill for what you are trying to do, but this will allow you to set the state of all the columns, whether they are visible or not, pinned to different sides, fixing the widths, etc.
Basically I can see you doing one of two things:
Create a button that will make all the columns visible and call gridOptions.columnApi.resetColumnState() when it is clicked
-- OR --
Create a list of check boxes that will listen for a change and call one of the other functions. This list could be outside of your grid, or even inside of your grid in a Custom Filter Component (find the athlete column of the first example to see what I mean.)

Angular Formly - HideExpression on page load

I have a number of fields on my form. When the user changes the selected value in a dropdown, there is a hideExpression on each field that shows/hides the fields depending on what the user has selected. This currently works fine.
However, I am trying to make the dropdown default to the first option in the select. This also works fine.
My issue is that all of the hideExpression logic is not being fired upon loading of the screen. So the select is defaulting correctly but none of the fields (that should be shown) that go with that option are visible.
If I manually change the dropdown value then everything is shown correctly. Is there a way to make the hideExpression logic get kicked off even when the select is being defaulted via code?
Here is a JSBin for my issue: http://jsbin.com/doliyiruza/edit?js,console,output
The page defaults to Option2. Yet, there is a hidden field that should show whenever Option2 is selected. So if you change the dropdown to Option1 and then back to Option2...you will see the hidden field. The hide/show logic doesn't seem to get kicked off if you set a dropdown to a certain value by default.
I'm not 100% sure why what you had wasn't working, but querying the DOM in your controller is a very very bad idea. Also, angular-formly intentionally tries to make field IDs non-deterministic so you can't do that (should probably make it more random). Here's what I think you're trying to accomplish: http://jsbin.com/bifaza/edit?js,console,output

ExtJS 4 - How to persist values of textfields in a floating panel when panel is hidden/shown?

I am building an ExtJS4 Web Application and there's a part where the user is shown a "Search Panel". It's basically a floating panel with textfields and a gridView. The textfields allow the user to put his or her input for first name and last name filters. There's also a combo box that the user can use to filter the search. The results are shown in the gridView. The search functionality works well.
However, when the floating panel is hidden and then shown, the fields are reset and the user would have to enter the input once more.
What I want to happen is for the textfield and combobox values to persist even though the panel is hidden then shown again. I have tried using setVisibility(false) then using setVisibility(true) but that did not work for me.
How can I persist values of fields when their parent view is hidden/shown?
The fields should have retained the value as you are just hiding and showing the search panel. It seems there is a bug in your program, but I cannot ascertain that without seeing some code. Assuming that your search panel includes a close button, I would suggest you to use closeAction: 'hide' on the panel instead of using setVisibility(). Also make sure that you are not creating multiple instances of search panel, use a single object of search panel.
Here is a quick fiddle http://jsfiddle.net/DirtyParadoxx/gL9aekzz/
If you want to use cookies, then as Nikolay Lopin suggested, stateful: true would be a nice way of doing it.

Resources