ColumnsControl Element
The control element ColumnsControl displays text fields in forms which allows users to enter values directly into the request items.
The ColumnsControl element generates an entire form field, including description. To enable basic functionality it is necessary to set up the displayed items (e.g. ShowColumns = "tHdTicket.sHdTicketCategory") or required items (e.g. RequiredColumns="tHdTicket.sHdTicketCategory"). Items are displayed in a top-bottom list in the selected sorting order.
Each ColumnControl element needs to be initialized. In the file with the .cs extension, in the ConfigControls() function use the following line for each ColumnsControl element used in the form: ((DynamicModel)Model).GetControl<ColumnsControl>("ColumnsControl0"); where you use the name of your element instead of ColumnsControl0.
If you insert this control element in the form between the <div id="CustomFormContent"> and </div> tags, calling the CreateTicket function will save all values automatically. This control can be used several times in a single page. Please see below for further setting options and an example of use.
Tip: We recommend configuring ColumnsControl using the attributes in the ( .cshtml) page. ColumnsControl can be also configured using the ( .cs) code.
Note: If you do not want to include these items in the request text, insert them outside of the <div id="CustomFormContent"> and the </div> tags. In this case, you will need to save all values manually by calling the UpdateColumns(...) function for each ColumnsControl and each request that you are creating.
Note: While loading a page, ColumnsControl will try to detect the SectionId automatically from the web address. If the web address contains the iHdSectionId=number parameter, the "number" will be used as an ID of the selected service, if no other ID has been set for the service. (Example: http://www.servicedesk.cz/Custom/ALVAO/NewTicket_Template/?iHdSectionID=11 contains the ID of the service No. 11. This will be used automatically as the SectionId.) This functionality can be disabled with the SectionId="0" setting or with the correct settings of the specific service.
Note:
ColumnsControl performs a basic permissions check:
- If TicketId is used, the user that is logged in must have sufficient permissions to display this request. Users with insufficient permissions will be redirected to an error page.
Format of parameters
The attribute and function descriptions use the following parameter formats:
- columns – list of columns with the following format: "table1.column1, table1.column2, etc…". This allows you to define one or more columns for the current ColumnsControl.
Enabled columns:
table.column |
Request Item |
Notes |
tHdTicket.mHdTicketNotice |
Notes |
|
tHdTicket.sHdTicketCategory |
Category |
Allows you to use other values in addition to the predefined ones (like in SD Console). |
tHdTicket.sHdTicketGroup |
Group |
Allows you to use other values in addition to the predefined ones (like in SD Console). |
tHdTicket.sHdTicketDeviceCode |
Device number |
|
tHdTicket.liHdTicketNodeId |
Device |
|
tHdTicket.sHdTicketHdBranch |
Area |
Allows you to use other values in addition to the predefined ones (like in SD Console). |
tHdTicket.FeedbackSolveSpeed |
Resolution speed |
|
tHdTicket.FeedbackProfessionality |
Professionalism |
|
tHdTicket.FeedbackExpertise |
Expertise |
|
tHdTicket.FeedbackComment |
Comments and notes |
|
tHdTicket.RelatedAccountId |
Related organizations |
|
tHdTicketCust.* |
custom items |
Individual columns in the tHdTicketCust table that represent custom items. Replace the asterisk character with the name of a specific column. |
- sectionId – service id
- sectionName – full service name including the path (e.g. "Helpdesk/Problems")
- mode – one of Edit (default) and View
- msg – string containing the text displayed next to a required form item that has not been filled in.
- ticketId – number of request to be displayed/saved.
Attributes in cshtml
- ShowColumns = columns – columns that need to be generated in the form and saved in the database. Columns are displayed in a top-bottom list in the selected sorting order.
- RequiredColumns = columns – columns that must be generated to enable the saving function. These columns have to be specified in the ShowColumns attribute. The sorting order does not matter.
- SectionId = sectionId – sets the service name and ID. This affects the values that are available for items with codes lists (if values are defined for a specific service).
- SectionName = sectionName – sets the service name and ID. This affects the values that are available for items with codes lists (if values are defined for a specific service).
- Mode = mode – sets the view mode.
- TicketId = ticketId – sets an ID for the request intended for editing/displaying/saving.
- CssClass – the CSS style class.
- IgnoreColumns = columns – these columns will be hidden.
- IncludeServiceColumns – flags whether columns will be displayed according to the service process specified in SectionId.
- IncludeRequiredColumns – flags whether required columns will be displayed according to the service process specified in SectionId.
Functions
Note: These functions are not necessary for basic functionality of the ColumnsControl control.
- UpdateColumns() – saves the form values in the database in the request whose ID is set with the TicketId attribute.
- UpdateColumns(int ticketId) – saves values in the database to the request number ticketId.
Example of use
Example of displaying the items Category (tHdTicket.sHdTicketCategory) and Notes (tHdTicket.mHdTicketNotice). The item Category is required:
- .cshtml + save automatically (by calling the CreateTicket function)
.... Your form content... @Html.EditorFor(m => m["ColumnsControl0"], "ColumnsControl", new { ShowColumns="tHdTicket.sHdTicketCategory, tHdTicket.mHdTicketNotice",RequiredColumns="tHdTicket.sHdTicketCategory"
}) .... Rest of the form...
You can find another example on "~/Custom/Templates/NewTicket_Template.cshtml" and in related forms.
Did not find what you were looking for? Ask our technical support team.
|