Collapse grid view by default?

[using Sp-7.11.1 at the time of writing]

Hi there,

I configured the preparation subview in order to display grid/table view by default:

<row>
  <cell type="subview" viewname="Preparation_4" id="8" name="preparations" colspan="14" rows="3" defaulttype="table"/>
</row>

It works as intended:

Nonetheless, the preparations are expanded by default, and I would like them collapsed by default:

I searched carefully :face_with_monocle: in the Editing Forms in Specify and Github issues, but I found nothing relevant for that matter.

I tried to play around with the view definition, by setting the Preparation Table view as the default one, without much success:

<view name="Preparation_4" objtitle="Preparation" class="edu.ku.brc.specify.datamodel.Preparation"
    busrules="edu.ku.brc.specify.datamodel.busrules.PreparationBusRules">
    <altviews>
        <altview name="Preparation_4 View" viewdef="Preparation_4" mode="view" />
        <altview name="Preparation_4 Edit" viewdef="Preparation_4" mode="edit" />
        <altview name="Preparation_4 Table View" viewdef="Preparation_4 Table" mode="view"
            default="true" />
        <altview name="Preparation_4 Table Edit" viewdef="Preparation_4 Table" mode="edit" />
    </altviews>
</view>

:red_question_mark: Is there a way to achieve collapsed grid/table view by default please?

Hey @pverley, I actually started experiencing the same issue after making an edit to one of our preparation table view defs 2 weeks ago. All I did was remove a single field from both the expanded and collapsed view def xml, but for some reason, it always displays as expanded by default now. I tried reverting it to what I had previously, and it also didn’t seem to work.

If you find a solution please let me know! And if not, Specify team, we want to know how to fix this too. :slight_smile:

1 Like

Hi @nfshoobs and @pverley,

Can you share your full form definition(s) with me so I can take a look? Thank you!

OSUM IZ.xml (168.8 KB)
Sure, here you go!

1 Like

NOU-AUBLET3.xml (182.5 KB)
Here’s NOU full form definition. Thanks Grant!

1 Like

Hi @nfshoobs and @pverley,

On our demo instance, I loaded the full form definition OSUM IZ.xml

The behavior I expected, and what I observed, is as follows:

  • When adding a new Preparation, the subview is expanded by default. Adding a subsequent Preparation does not collapse the ones entered earlier.

  • When viewing a Collection Object record, all Preparations are collapsed by default.

  • After importing NOU-AUBLET3.xml, I see the same:

The current, expected behavior is to expand newly added items to a subview and this is not configurable (code reference).

Just to confirm, you looking to have the subview show every Preparation as collapsed by default when they are added to the form?

Hey @Grant,
Thanks for looking into this. The issue is not with preparations expanding the grid view by default when they are added. As you point out, that is the expected behavior and has always been the case.

What we are experiencing (I think we are both experiencing the same thing, but perhaps @pverley is not) is that editing the viewdef file to remove a field caused all CO records to automatically expand all preparations by default whenever you load an existing record.

That is unexpected and unwanted behavior, the way it used to be was that grids were collapsed by default upon pageload.
See https://invertebrates.osu.edu/specify/view/collectionobject/498055/ for an example, the preparations are all expanded when the page opens.

@pverley

Is this the same issue you are seeing?

@nfshoobs

Thank you for sharing that link! I see the same as you on your database, but I cannot recreate on my end. Can you send me a copy of the database so I can take a look in a development environment?

Sure, what’s the most efficient way for me to send you a backup?

I had an idea – it may be due to a conflict between two viewdefs, one (common.views) added by Bronwyn a few months ago that I’m still kind of confused about the purpose of. I’ll prep a DB dump for you, but in the meantime, could you try uploading common.views into the demo instance and see whether it recreates the behavior?

(attachments)

common.views.xml (402 KB)

1 Like

Hi @nfshoobs,

I’ll take a look at that as well!

You can follow these steps to share the database:

  1. Go to our Hightail page: Hightail
  2. Enter your email address and any notes.
  3. Click Select a file, choose your backup archive, then click Send It.
1 Like

Yes, it is. When I open a CO form with existing preparations and scroll down to the Preparations subview every prep is expanded by default.

Unfortunately my memories are not as sharp as Nate and I cannot relate it with any change in the form (though it is possible).

Seeing your animation, I tried to reproduce it step by step and here is what I see:

  1. I opened an existing CO form with several preparations => preparation views are expanded
  2. I added a new preparation (expanded by default, as expected when one create a new entry) and saved => CO view get refreshed and preparation views are collapsed
  3. I refreshed my page => preparation views are expanded
  4. I deleted the bogus preparation (the one added at step 2) and saved the CO => CO view get refreshed and preparation views are collapsed

nou-sp7-gridded-preparations

Thanks for you time on this issue :folded_hands:

2 Likes