Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define order of CollectionObjects in CE form #1213

Closed
grantfitzsimmons opened this issue Apr 1, 2022 · 3 comments
Closed

Define order of CollectionObjects in CE form #1213

grantfitzsimmons opened this issue Apr 1, 2022 · 3 comments
Labels
1 - Request A request made by a member of the community
Milestone

Comments

@grantfitzsimmons
Copy link
Member

Is your feature request related to a problem? Please describe.
Collection Objects in Specify 7 are ordered by timestamp created while in 6 they are ordered from the Collection Reg. No. name. Can the order of these objects be be defined in the configuration so that both 6 and 7 order these the same?

Reported By
Corinna at CSIRO

@grantfitzsimmons grantfitzsimmons added 1 - Request A request made by a member of the community pri:unknown labels Apr 1, 2022
@maxpatiiuk
Copy link
Member

Do you know if sp6 stores the field it is sorting by somewhere?
It is in the form definition? If so, I can just make sp7 read that field from the definition and sort by it

@grantfitzsimmons
Copy link
Member Author

I don't think that Sp6 stores the field it is sorting anywhere in the forms. The behavior is controlled by something internally. See below:

Collecting Event row:

                <row>
                    <cell type="subview" viewname="CollectionObjectSub" id="11" colspan="9" rows="3" name="collectionObjects" initialize="addsearch=true"/>
                </row>

CollectionObjectSub def:

        <viewdef
              type="form"
              name="CollectionObjectSub"
              class="edu.ku.brc.specify.datamodel.CollectionObject"
              gettable="edu.ku.brc.af.ui.forms.DataGetterForObj"
              settable="edu.ku.brc.af.ui.forms.DataSetterForObj">
              <desc><![CDATA[The Collection Object Subform for appraisal and project forms.]]></desc>
              <enableRules/>
              
              <columnDef>100px,2px,120px,5px,100px,2px,98px,5px,95px,2px,98px,5px,95px,2px,98px,p:g</columnDef>
              <columnDef os="lnx">115px,2px,152px,5px,107px,2px,100px,5px,110px,2px,100px,5px,110px,2px,100px,p:g</columnDef>
              <columnDef os="mac">130px,2px,150px,5px,127px,2px,121px,5px,120px,2px,121px,5px,119px,2px,121px,p:g</columnDef>
              <columnDef os="exp">p,2px,min(p;150px),5px:g,p,2px,p:g(2),5px:g,p,2px,p:g(2),5px:g,p,2px,p:g(2)</columnDef>
              <rowDef auto="true" cell="p" sep="2px"/>
		  
              <rows>
                <row>
                    <cell type="label" labelfor="1"/>
                    <cell type="field" id="1" name="catalogNumber" uitype="formattedtext"/>
                    <cell type="label" labelfor="2"/>
                    <cell type="field" id="2" name="altCatalogNumber" uitype="text"/>
                    <cell type="label" labelfor="3"/>
                    <cell type="field" id="3" name="collection.collectionName" uitype="dsptextfield"/>
                    <cell type="label" labelfor="4"/>
                    <cell type="field" id="4" name="projectNumber" uitype="text"/>
                </row>
             </rows>
        </viewdef>

@maxpatiiuk
Copy link
Member

Fixed in 063ac17
Replace

<cell
  type="subview"
  viewname="CollectionObjectSub"
  id="11"
  colspan="9"
  rows="3"
  name="collectionObjects"
  initialize="addsearch=true"
/>

with

<cell
  type="subview"
  viewname="CollectionObjectSub"
  id="11"
  colspan="9"
  rows="3"
  name="collectionObjects"
  initialize="addsearch=true;sortfield=someField"
/>

where "someField" is the field you want to sort by.
This would sort in the Ascending direction. To do Descending sort, prepend field name with a dash (e.i "-timestampcreated")

This also works for forms in grid view (i.e. formtable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Request A request made by a member of the community
Projects
None yet
Development

No branches or pull requests

2 participants