User Tools

Site Tools


newdevs:code:angular-field-order

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
newdevs:code:angular-field-order [2023/02/14 13:16] tmccannanewdevs:code:angular-field-order [2024/06/05 13:29] (current) – [Adding Field Row Styling to Modals] tmccanna
Line 1: Line 1:
 **New Developers Working Group** **New Developers Working Group**
-====== Control Angular Form Field Order ======+====== Control Field Order and Styling in Form Modals ======
  
-If you do not specify the field order when opening an Angular form in a modal, the fields will be displayed in alphabetical order. This can be very confusing, so it is good practice to add a fieldOrder parameter to the relevant HTML file. +===== Controlling Field Order =====
  
-An example of this can be seen in admin-carousel.component.html:+If you do not specify the field order when opening an Angular form in a modal, the fields will be displayed in alphabetical orderTo improve readability and usability, it is best to specify the desired field order either through the relevant routing module (for dynamically-created interfaces) or through the HTML template (for interfaces that have additional customizations)
  
 +==== Via the Routing Module ====
 +
 +When you are working with a basic, dynamically-created interface you can control the field order by modifying the relevant **routing.module.ts** file. Note that you can also specify certain fields as visible but read-only. For example:
 +
 +<code>
 +     path: 'asset/copy_location',
 +     component: BasicAdminPageComponent,
 +     data: [{
 +         schema: 'asset',
 +         table: 'copy_location',
 +         readonlyFields: 'deleted',
 +         fieldOrder: 'owning_lib,name,opac_visible,circulate,holdable,hold_verify,
 +             checkin_alert,deleted,label_prefix,label_suffix,url,id'}]
 +</code>
 +
 +A good example of this is in /eg2/src/app/staff/admin/local/routing.module.ts
 +
 +==== Via the HTML Template ====
 +
 +The grid column and modal field order can be controlled by adding the **fieldOrder** parameter to the relevant HTML file:
 +
 +<code>  fieldOrder="field1,field2,field3"</code>
 +
 +An example of this in action can be seen in admin-carousel.component.html:
 +
 +<code>
   <eg-fm-record-editor #editDialog idlClass="{{idlClass}}"    <eg-fm-record-editor #editDialog idlClass="{{idlClass}}" 
     [preloadLinkedValues]="true"     [preloadLinkedValues]="true"
Line 18: Line 44:
       owning_lib_filter:{customTemplate:{template:orgTemplate}}}">       owning_lib_filter:{customTemplate:{template:orgTemplate}}}">
   </eg-fm-record-editor>   </eg-fm-record-editor>
-  +</code> 
 + 
 +Note that you can also make use of the **hiddenFieldsList** parameter for fields that do not need to show on the form, and of the **readonlyFields** parameter to make specified fields uneditable. 
 + 
 +===== Adding Field Row Styling to Modals ===== 
 + 
 +Beginning in Evergreen 3.13 ([[https://git.evergreen-ils.org/?p=Evergreen.git;a=commit;h=290ddfcd6273b0d33ab04e9fef141a2a1ee6c7e5|LP1915464]]), it is now possible to add CSS styling to specific field rows in modals that are generated by the Fieldmapper Editor Component (fm-editor.component.css).  
 + 
 +First, you will need to identify the fieldmapper's class ID (found in **fm_IDL.xml** - for example, 'chmm' is the class ID for the Local Admin > Hold Policies interface that is generated from the config.hold_matrix_matchpoint database table) and the names of the fields you wish to style (for example, 'item_owning_ou').  
 + 
 +Then, modify **eg2/src/app/share/fm-editor/fm-editor.component.css** to add styling to the specific rows. The Local Admin > Hold Policies modal is already styled to break the long list of fields into logical groupings (starting with the fields for Owning Library, User Home Library, Holdable?, and Requestor Permission Group) with space and a dotted line between each group: 
 + 
 +<code> 
 +.row { 
 +   --section-border: 2px dotted var(--bs-gray-900); 
 +   --section-padding: 2.5rem; 
 + } 
 +  
 +/* Modal for Local Admin > Hold Policies */ 
 + .chmm .row.item_owning_ou, 
 + .chmm .row.user_home_ou, 
 + .chmm .row.holdable, 
 + .chmm .row.requestor_grp { 
 +   border-top: var(--section-border); 
 +   padding-top: var(--section-padding); 
 + }
  
-See the example in git at: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=blobdiff;f=Open-ILS/src/eg2/src/app/staff/admin/local/admin-carousel.component.html;h=aede0adbf96b5f4dbba25baecef3d4cbba8040a2;hp=6740171a14c11e7a3b3b8d81f08d12d3bcac4de2;hb=f5fe60def6e5fe4ed6d0cf9a45401e7250bc1d54;hpb=13bf5d76eafa9f5a3c62d2dcc4b8bd19ddf64393+</code>
  
  
newdevs/code/angular-field-order.1676398579.txt.gz · Last modified: 2023/02/14 13:16 by tmccanna

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.