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

MatTable #277

Closed
rogeralsing opened this issue Oct 2, 2019 · 21 comments
Closed

MatTable #277

rogeralsing opened this issue Oct 2, 2019 · 21 comments

Comments

@rogeralsing
Copy link

What do I use to control cell and table width on the MatTable?
This is the standard fetch weather data from Blazor examples converted to MatBlazor.

The table is so big that it gets a horizontal scrollbar.
And cells are cramped together.

Are there any settings Im missing, or am I just supposed to use normal styles?

Skärmavbild 2019-10-02 kl  09 24 46

@rogeralsing
Copy link
Author

Also, is there any way to use MatTable w/o databinding just as a plain table, for look and feel consistency?

@milenpav
Copy link

milenpav commented Oct 3, 2019

i fix it this on MainLayout <MatDrawerContainer Style="width: 98vw; height: 99vh;">

@dannyaguilerar
Copy link

Newbie here: Its not much, but you could choose one of the columns you prefer and set the style as such:

<th style="width:100%;">Details</th>

This way Details column will always get the rest of the available width in the column. It also fixes the column header when its empty. Hope it helps.

@GitSheva
Copy link

GitSheva commented Jul 23, 2020

is this issue was fixed? I can't make it work. I'm adding width % to each column

<MatTable Items="@cars" class="mat-elevation-z5" Striped="true">
    <MatTableHeader>
        <th style="width:50%;">Name</th>
        <th style="width:25%;">Price</th>
        <th style="width:25%;">Horsepower</th>
    </MatTableHeader>
    <MatTableRow>
        <td style="width:50%;">@context.Name</td>
        <td style="width:25%;">@String.Format("${0:f2}", @context.Price)</td>
        <td style="width:25%;">@context.Horsepower</td>
    </MatTableRow>
</MatTable>

not too much to ask right? any thoughts?

image

@GitSheva
Copy link

partially fixed this with min-width, thanks.

@fededim
Copy link

fededim commented Sep 3, 2020

Is this issue still being watched ? Putting min-width in style (for both th and td bleah!) only resizes them when mattable has no data, when it is filled the columns go back to standard size. Sizing of the columns of the table should be managed in some way otherwise this component becomes unusable!

<MatTable @ref="_reliabilityTable" Items="@Reliabilities" class="mat-elevation-z5" PageSize="100">
    <MatTableHeader>
        <th>@strings.Id</th>
        <th style="min-width:20%">@strings.Name</th>
        <th style="min-width:50%">@strings.ReferenceCountSessions</th>
        <th>@strings.Reliability</th>
    </MatTableHeader>
    <MatTableRow>
        <td>@context.Id</td>
        <td style="min-width:20%">@context.Name</td>
        <td style="min-width:50%">@context.ReferenceCountSessions</td>
        <td>@context.Reliability</td>
    </MatTableRow>
</MatTable>

@daveoakley
Copy link

I have spent hours fiddling with this with no success. I can't find a way to limit the overall size of the matTable and the individual columns dont want to resize. There needs to be a way to at least make the last column fill the table space otherwise this control is extremely limited as to when you can actually use it.

@daveoakley
Copy link

daveoakley commented Sep 28, 2020

Actually, i think i've solved it. By setting width:100% on the 2nd column, it seems to place the last column where i need it to be:

        <MatTableHeader>
            <MatSortHeaderRow SortChanged="@SortData">
                <th></th>      
                <MatSortHeader SortId="description"><span >Description</span></MatSortHeader>
                <MatSortHeader SortId="enabled"><span>Enabled</span></MatSortHeader>
            </MatSortHeaderRow>

        </MatTableHeader>
        <MatTableRow>
            <MatIconButton Icon="construction" OnClick="@(() => OpenEditDialog(@context.CompanyID))" ></MatIconButton>
            <td style="width:100%">@context.Description</td>
            <MatCheckbox Disabled="true" @[email protected]></MatCheckbox>
        </MatTableRow>

@HClausing
Copy link

By searching how to solve this problem, I found this option on default html table:

<table>
                <colgroup>
                    <col span="1" style="width: 15%;">
                    <col span="1" style="width: 15%;">
                    <col span="1" style="width: 70%;">
                    <col span="1" style="width: 15%;">
                </colgroup>
</table>

But, unfortunatelly, it's not possible to declare on MatTable directly.

@HClausing
Copy link

I've created a PR #749 with this proposal for MatTable.

@fededim
Copy link

fededim commented Oct 11, 2020

By searching how to solve this problem, I found this option on default html table:

<table>
                <colgroup>
                    <col span="1" style="width: 15%;">
                    <col span="1" style="width: 15%;">
                    <col span="1" style="width: 70%;">
                    <col span="1" style="width: 15%;">
                </colgroup>
</table>

But, unfortunatelly, it's not possible to declare on MatTable directly.

Html tables do support width in th tags, please see this HTMLFiddle...the problem is that for some reason they are not displayed right with MatBlazor (probably due to a CSS).

@daveoakley
Copy link

daveoakley commented Oct 11, 2020 via email

@HClausing
Copy link

No I don’t think its possible with MatTable. I did manage to get a fixed size to work on the MatSelect buy overriding this CSS : /override this stop set select box widths/ .mdc-select__anchor { min-width:350px !important } So it’s likely there will a CSS for the table, but I don’t see how you could set the width on a column by column basis using CSS, as obviously columns are dynami. I hope they fix this otherwise I’ll have to find a better table component. From: Federico Di Marco [email protected] Sent: 11 October 2020 10:49 To: SamProf/MatBlazor [email protected] Cc: Dave Oakley [email protected]; Comment [email protected] Subject: Re: [SamProf/MatBlazor] MatTable (#277) By searching how to solve this problem, I found this option on default html table:

But, unfortunatelly, it's not possible to declare on MatTable directly. Html tables do support width in th tags, please see this HTMLFiddlehttps://jsfiddle.net/0zkjbv4w/...the problem is that for some reason they are not displayed right with MatBlazor (probably due to a CSS). — You are receiving this because you commented. Reply to this email directly, view it on GitHub<#277 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANHJKJWDSQZUMLKB7LWDUSTSKF5PLANCNFSM4I4SZQWA.

Hi,

Well, on private tests here with the PR #749 , it appears to be one possibility to resolve.

@daveoakley
Copy link

daveoakley commented Oct 12, 2020 via email

@HClausing
Copy link

I might be using an older version of matTable as it does not recognise as a valid child component? From: Henrique Clausing [email protected] Sent: 11 October 2020 22:20 To: SamProf/MatBlazor [email protected] Cc: Dave Oakley [email protected]; Comment [email protected] Subject: Re: [SamProf/MatBlazor] MatTable (#277) No I don’t think its possible with MatTable. I did manage to get a fixed size to work on the MatSelect buy overriding this CSS : /override this stop set select box widths/ .mdc-select__anchor { min-width:350px !important } So it’s likely there will a CSS for the table, but I don’t see how you could set the width on a column by column basis using CSS, as obviously columns are dynami. I hope they fix this otherwise I’ll have to find a better table component. From: Federico Di Marco [email protected]mailto:[email protected] Sent: 11 October 2020 10:49 To: SamProf/MatBlazor [email protected]mailto:[email protected] Cc: Dave Oakley [email protected]mailto:[email protected]; Comment [email protected]mailto:[email protected] Subject: Re: [SamProf/MatBlazor] MatTable (#277<#277>) By searching how to solve this problem, I found this option on default html table: But, unfortunatelly, it's not possible to declare on MatTable directly. Html tables do support width in th tags, please see this HTMLFiddlehttps://jsfiddle.net/0zkjbv4w/...the problem is that for some reason they are not displayed right with MatBlazor (probably due to a CSS). — You are receiving this because you commented. Reply to this email directly, view it on GitHub<#277 (comment)<#277 (comment)>>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANHJKJWDSQZUMLKB7LWDUSTSKF5PLANCNFSM4I4SZQWA. Hi, Well, on private tests here with the PR #749<#749> , it appears to be one possibility to resolve. — You are receiving this because you commented. Reply to this email directly, view it on GitHub<#277 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANHJKJVA3FO27UNGNBCL25DSKIORFANCNFSM4I4SZQWA.

Hi @daveoakley ,

The Pull Request for this feature isn't approved by admin yet. It's not available for all. I have only on my fork of this repository here.

@dorana
Copy link

dorana commented Oct 26, 2020

Having the same issue, really hoping the PR gets approved, merged a new new NuGet gets released ^_^

@pfeds
Copy link

pfeds commented Nov 9, 2020

Same issue.

@tiajean
Copy link

tiajean commented Nov 27, 2020

Same issue.

What is your issue? Can you post your code? I just started using MatBlazor but do not have this issue with my tables.

@ldcroberts
Copy link

Same issue.

What is your issue? Can you post your code? I just started using MatBlazor but do not have this issue with my tables.

https://blazorfiddle.com/s/60ed0fn6

@ldcroberts
Copy link

for anyone with the same issue as Gitsheva above, I found a workaround. Just put a bunch of non-breaking spaces after your column header name until its as wide as you want and you don't get the weird white-space bug

@BobLangdown
Copy link

I think this product has been abandoned, I don't see any replies for a long time.
Shame because it had some good features but can't be responsive if you can't use %age ColumnWidth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests