Max width adjustment

Is there a way to adjust (widen) the width of Max width grids.
Max width is too narrow and Full width is to wide.

Also, is there a way to change the Max width and the form width separately?

Hi @EdCooper15510,

You may find our developer documentation on Using CSS helpful for this goal. Also, this thread here may also be helpful: CSS to Change Table Width.

Best of luck and happy Friday! :slight_smile:

Hi @EdCooper15510

This has come up a lot recently. The easiest way to do this is to add this span to a grid description:

<span class="max-width-1000"><\span>

The 1000 will equal the max-width so this can be useful for other widths just change the number in the span, CSS and the pixels.

Then in your CSS you can have,

#knack-body .kn-view:has(.max-width-1000) {
    max-width: 1000px;
}

The reason I suggest this way is that you can then add the above span to any view (grid or otherwise) and it will make the view max-width 1000px.

Change the pixels and the class to suit but this give you reusable CSS for any view.

Craig

1 Like

I only use Full Width and then target any tables specifically if I need to reduce the percentage width via CSS.

#view_1 table.kn-table-table {
    width: 75%;
}
#view_115 table.kn-table-table {
    width: 30%;
}

Go with @CSWinnall as he’s a coder :blush:

2 Likes

@CarlHolmes

Both ways work just as well it depends if you have one or 2 views you wish to apply this to.

Carls way will work fine for 2 views but if you want more than 2 views the same width then the span way will work better as you have less CSS.

You can also alter the CSS to work with percentages like Carl suggested.

Craig.

Thanks guys.
We’re going to try both approaches.

Thanks guys.
Based on what you gave us we got it working the way we wanted!

3 Likes

We’ve decided to use the Max width grid and modals for add/edit.
After adding a new record in Modal and closing the modal form, when I go back to the grid the new record is not there unless I refresh the page.
How do I fix that?

You will need to “redirect to parent” in the submit rules of the form or use code to refresh the grid after the form has submitted.
Craig

Tried re-direct to parent page but that didn’t cause the parent page (grid) to refresh and display the new record.

Craig,
What would the refresh code look like?

That’s odd that’s has never failed us. It refreshes the whole scene so if you have added a record it should appear in the grid. Does doing a browser refresh show the record?

Craig

Yes

Ed Cooper

Ok got it working.
Using submit rule not page rule.

Ed Cooper

Great

Thanks for your help.
We’re still working on one issue on making it happen on a 2 part form.

Add form with just a few fields calls the edit form which has many fields.
We’ve added the submit rule to the edit form which should take us back to the grid which it does but doesn’t refresh the page.

If we’re using the submit rule on a one page form it works fine.

Organization add form( 5 fields as a header) calls Organization edit form ( 15 fields).
When we add the submit rule to call a specific page (Organization grid), the grid does not refresh.
Working on it now.

OK we have it all working now perfectly.
Thanks for all your help!

1 Like

Any way to display “last modified date” and Last Modified by" in a grid?
Real need this.

Hi Ed

You will need to have 2 fields in the object then set record rules on every cell edit/form to update those fields. The last modified by would be a connection to the accounts object and the date field.

For last modified set the field to the logged in user. And the date field to current date.

There is no inbuilt Knack feature for this.

@Les I think this should be added to Knack as setting record rules for this is very tedious. I think there should be a field/s that record when a record is last updated and who by that we could add. We have these 2 fields in nearly every object in our app.

Craig