User Tools

Site Tools


newdevs:angularclient:basicadmin

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
newdevs:angularclient:basicadmin [2025/03/28 16:09] – fleshing vs. settings; IDL vs. Hash slearynewdevs:angularclient:basicadmin [2025/04/02 15:59] (current) – syntax highlighting sleary
Line 16: Line 16:
 To render a combobox, set that field's options to customValues: myComboBoxEntriesArray: To render a combobox, set that field's options to customValues: myComboBoxEntriesArray:
  
 +<code html>
    [fieldOptions]="{    [fieldOptions]="{
     myFieldName1: {customValues: myComboBoxEntriesArray}     myFieldName1: {customValues: myComboBoxEntriesArray}
    }"    }"
 +</code>
  
 To render a custom template (with optional context arguments), set: To render a custom template (with optional context arguments), set:
  
 +<code html>
    [fieldOptions]="{    [fieldOptions]="{
      myFieldName1: {customTemplate: {template: myTemplateRefHashFor1}},      myFieldName1: {customTemplate: {template: myTemplateRefHashFor1}},
      myFieldName2: {customTemplate: {template: myTemplateRefHashFor2, context: {letVarName: myFieldName2ContextData}}}      myFieldName2: {customTemplate: {template: myTemplateRefHashFor2, context: {letVarName: myFieldName2ContextData}}}
    }"    }"
 +</code>
  
 for example: for example:
  
 +<code html>
    [fieldOptions]="{    [fieldOptions]="{
       event: {customTemplate: {template: eventTemplate}},       event: {customTemplate: {template: eventTemplate}},
Line 45: Line 49:
     </output>     </output>
    </ng-template>    </ng-template>
 +</code>
  
 Always use: Always use:
Line 56: Line 61:
 Use ''pcrud.retrieve()'' to fetch a row by its primary key: Use ''pcrud.retrieve()'' to fetch a row by its primary key:
  
 +<code JavaScript>
    pcrud.retrieve('aou', 1).then( org => console.log(org.shortname()) );    pcrud.retrieve('aou', 1).then( org => console.log(org.shortname()) );
 +</code>
    
 Use ''pcrud.search()'' to do a full query with a WHERE object (the second argument): Use ''pcrud.search()'' to do a full query with a WHERE object (the second argument):
  
 +<code JavaScript>
    pcrud.search('aou', {id : [1,2,3]}).then( orgs => console.log(orgs.length) );    pcrud.search('aou', {id : [1,2,3]}).then( orgs => console.log(orgs.length) );
 +</code>
  
 Use ''pcrud.search()'' with a third argument to add limit, order_by, and fleshing: Use ''pcrud.search()'' with a third argument to add limit, order_by, and fleshing:
  
 +<code JavaScript>
    pcrud.search('aou', {id : {'!=' : null}}, {limit : 10}).then( orgs => {    pcrud.search('aou', {id : {'!=' : null}}, {limit : 10}).then( orgs => {
      for (const org of orgs) {      for (const org of orgs) {
Line 71: Line 79:
      }      }
    } );    } );
 +</code>
  
   * Note that booleans are given as '''t''' or '''f'''   * Note that booleans are given as '''t''' or '''f'''
Line 78: Line 86:
 Record notes example: Record notes example:
  
 +<code JavaScript [enable_line_numbers="true"]>
             const where = {             const where = {
               record: this.recId,                record: this.recId, 
Line 103: Line 112:
                     complete: this.emitNoteCount                     complete: this.emitNoteCount
                 }));                 }));
 +</code>
  
 ==== Fleshing ==== ==== Fleshing ====
Line 115: Line 124:
 Pcrud returns columns as functions: Pcrud returns columns as functions:
  
 +<code JavaScript>
    org.shortname();    org.shortname();
 +</code>
  
 To set a new value, pass the value as an argument: To set a new value, pass the value as an argument:
  
 +<code JavaScript>
    note.value(new_note_text);    note.value(new_note_text);
 +</code>
  
 The IDL service has a toHash() method that can make this easier to work with if all you're doing is reading data: The IDL service has a toHash() method that can make this easier to work with if all you're doing is reading data:
  
 +<code JavaScript>
   idl.toHash(org_unit);   idl.toHash(org_unit);
   console.debug("Org unit is:", org_unit.shortname);   console.debug("Org unit is:", org_unit.shortname);
 +</code>
  
 Note there is an option to flatten the data. Note there is an option to flatten the data.
Line 130: Line 145:
 As of 3.15, there is also a way to go from a hash back to a proper IDL object: As of 3.15, there is also a way to go from a hash back to a proper IDL object:
  
 +<code JavaScript>
   idl.fromHash(some_object, 'aou');   idl.fromHash(some_object, 'aou');
 +</code>
      
 The classname is the second argument. There is an optional third argument to convert booleans from '''t/f''' to ''true/false'' The classname is the second argument. There is an optional third argument to convert booleans from '''t/f''' to ''true/false''
newdevs/angularclient/basicadmin.1743192550.txt.gz · Last modified: 2025/03/28 16:09 by sleary

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.