I want to save and load column settings (width, visibility, order, etc.) for each user in localstorage or on the server (I have not decided yet). To do this, I made my own component, which should be able to load, save and apply grid settings (<vaadin-state-storing />).
I think I can get the order. But how do I set the order of the columns at the javascript level? (table with default precedence already shown, I want to apply user settings).
Related
I've been looking for an approach to remove unwanted values from a views grid column filtering dropdown but I'm not sure if its even possible.
A specific view in our app only displays results where the column will contain 5 values, however the column option set has 20+. Is it possible to remove the unwanted 15 values from being displayed when the view's filter by function is used?
This documentation does not mention any way the values can be hidden.
I have added a web resource to a view column before, to change text values into an image, however I don't think this is an applicable place to add a script to hide filter by values.
I have developed plugins so not against using this medium if the approach works and does not introduce a performance hit.
Unfortunately that header filter is not open for customization/configuration. Though MS mention it as Excel like filter, it is not going to give the filter options for only values from current list. It will load the full options list.
When we had such requirements in the past - we have developed a PCF control with grid + filters and used it instead.
Scenario/Context
I've got a drop down menu with two input elements underneath.
From the dropdown menu, are names of companies (with values set to the respective company id's), and another prompt to Add a new company.
If the option to Add a new company is selected from the dropdown, then the user is to fill out the 2 input field elements (i.e. company name and company email).
Otherwise, if an available company is selected from the dropdown,
then the 2 input fields (for company name and email are to be disabled).
My question
Is this possible to do without an AJAX call if I want things to happen without a page refresh?
Can anyone suggest some other alternatives??
Many thanks!
That is absolutely possible, though you'd need to use some JavaScript to make it happen and load a bit more data to the DOM on the initial page load.
For each option in your company select dropdown, add a data attribute for the name and email.
Then, watch that dropdown for the change event in JavaScript. Whenever that event is fired, if the data-company-name and data-company-email attributes are defined for the selected option, disable the input fields and populate them with those values. If those data attributes are not defined for the option (likely only for your 'Add a new company' option), then clear the values from the input fields and enable them.
I am currently working on a project in ServiceNow that requires me to configure around 500 descendants of the Configuration Item table by adding multiple form sections to the CI's with around 10-20 fields in each of these form sections. I currently am doing this by going into the Form Design for each CI, and manually adding these form section and fields for every CI individually, which takes far to long to do for 500 CI's.
Is there a way to add a form section to multiple CI's without having to go into the form design on every CI you want to change and adding it manually?
Technical answer: yes, because all of that form layout data is stored in tables (sys_ui_form_section, sys_ui_section, sys_ui_element, etc) that you could script to insert relevant records. However, due to the complexity (form sections, form elements, ordering) and the potential to run into conflicts (forms differ between tables), I would recommend this only as a last resort.
I think the real question is why is it required to have all of those fields displayed on the forms? If you're populating data from Discovery or a large import, can those fields just be visible by a list page, or just be available to use in filters? Will users actually be clicking to view a CI record and need to see that data on the form? The other part to consider is which view you are adding all of these form sections and fields to. As an example, a user won't see the data on a reference field hover if you're only making changes to the Default view, and won't see any of the fields on a mobile device if you don't add to the Mobile view.
I am creating a maintenance page where I want to select a task using browser UI component. What I want to do specifically is to filter and show only tasks that are not done yet. Can I implement this using browser UI component? Does Exact Synergy Enterprise offer other components for this functionality?
You should create your browser Repository Explorer and use it in browsefield UI component.
Go to System tab, process to Setup tab and under the Repository section click Explorer. Locate your Repository group, enter it, click Browsers tab next to Business components, Functional components, etc.
Click Add and provide Name, Caption, Caption suffix fields. Then write your SQL query in Query field. The structure is:
SELECT <column(s)> FROM <database table> WHERE <column(s)> IS NOT NULL ORDER BY <column>.
Leave the Column info field empty for now. Fill in the Result columns field with column name which will be used as a Browser component result.
Finally, add database table name in the Table list field. Click Save + Edit column info button. Edit column names from a list shown below Information section and fill in Header/Term ID field with title, describing your columns (this will be shown in Browser UI for the front-end user). Click Save and test your newly created browser. If something went wrong, repeat steps from the start. Most of the time problem could be wrongly filled Column info field.
Now go to your ASPX page and add browsername attribute to your browsefield UI component. Doing so will set the browserfield component to your newly created browser component. This is that you want to see in your maintenance page when setting up the browsefield UI component:
<ex:cardfield runat="server" id="cf" caption="Item" captionid="0">
<ex:browsefield runat="server" id="p" browsername="pbr" datasource="bc" />
</ex:cardfield>
Hope this gives you quick idea of what you need to do in order to adjust it to your situation with tasks.
I have some data Grid Views and I want the user to be able to keep changes he does to them. Not the Data changes, only the layout changes, like the width, the hight, the order of the columns and maybe the visibility of them. I don't care if it will be automatic or by clicking a button...
Edit: I found a way to do this using Settings.I have added the settings file, but I have no idea of how I'm supposed to add column order or column size in those settings
The kind of formatting information you want to save can be found in the various properties of the DataGridGiew. You may have to spend some quality time with its object model documentation, but you should be able to find most of what you're looking for.
For example, to save the way the rows have been sorted, you can persist these two properties:
DataGridView.SortedColumn tells you on which column's values the rows were sorted.
DataGridView.SortOrder tells you the order (i.e. ascending or descending)
And you should be able to find info about column widths and order on the members of the DataGridView.Columns collection.
I think it's a matter of preference whether you record these values all at once (e.g. click a "save settings" button) or one by one in event handlers as the properties get changed. I like to save them automatically when the form is closed w/out any action by the user. It's been a while since I implemented anything like this, but I recall the app settings being a pretty handy place to keep this sort of info. In the Project Properties Settings designer, just define settings for the stuff you want to keep (make sure to set the Scope to "user"). Then assign and load actual values in your code at run-time, like so:
// e.g. you defined an integer user setting at design time called ColA_Width, to
// hold the value of the width of "ColA" in your DataGridView.
// Use this code to save the value (either in a specific event handler, or a
// global "save settings" routine).
Properties.Settings.Default.ColA_Width = MyDataGridViewInstance.Columns["ColA"].Width;
Properties.SEttings.Default.Save();
// Then you'd reverse the assignments when the app next loads so that the saved
// settings are "remembered" between user sessions.
MyDataGridViewInstance.Columns["ColA"].Width = Properties.Settings.Default.ColA_Width;
The only caveats I can recall are that some of the DataGridView property values are not straightforward to save as strings (remember that your user settings are ultimately saved as XML), but it really depends on what sort of settings you're saving.
I am assuming you mean the end user, if so then I would store that info in cookie/database and pull it on load to customize their experience.
In each of your event handlers for resizing/sorting you could have a helper function that writes the layout instructions to a storage medium like a db, registry, xml, config, etc... and read those instructions to draw the interface when the application loads.