SfGrid Filter in Mobile Mode Hides Interface
Hi Team Syncfusion,
After generating a minimum stylesheet with your studio, I am experiencing an unexpected styling when displaying the SfGrid filter in mobile mode (360px):
https://i.imgur.com/U8pcgwJ.png
You can see that the "OK" and other elements are hidden by the dialog. Is this a known issue?
Thank you for any assistance you can provide,
Michael
Hi Mike,
Based on the reported issue, we understand that in mobile mode, the OK
button and other filter dialog elements are hidden when using the
stylesheet generated through Theme Studio. We have attempted to
reproduce the problem in our end. However, we were unable to replicate the
issue. For your reference, we have attached a sample and screenshot that
demonstrate the behavior observed at our end. Please review them and let us
know if the issue persists in your application.
Screenshot:
|
|
Sample: Please check the attachment.
To help us investigate further, could you please provide the following
additional details:
- Could you please share us the grid code sippet with model class?
- Could you please share a video demonstrating the issue?
- Could you please share us the Syncfusion NuGet version?
- Kindly provide a minimal sample project that reproduces the issue. Alternatively, please try to reproduce the issue using the attached sample.
Providing these details will help us analyze the issue more effectively and identify the root cause. Thank you for your cooperation!
Additionally, we were unable to open the image you attached. Could you
please reattach the image file.
|
|
Regards,
Prathap Senthil
Attachment: DataGridMobileFilter_63755d79.zip
Hi Prathap,
Thank you very much for your time and support! They are both greatly appreciated. I looked into this further, and it appears that this is due to me using the bootstrap5-lite.css. Additionally, I didn't realize we could filter the studio to the only controls that we use, so I did that, used bootstrap5.css (which went from 2.5MB to 1.5MB) and everything is working as expected now.
Thank you again very much for taking the time to investigate this along with creating a project to help diagnose!
Thanks for the update. We are glad to hear that the issue has been successfully resolved. We will now close this thread.
Hi Prathap,
Sorry, one more quick question for you:
Notice how the alignment looks off in mobile? This looks really broken to me and in mobile it would seem everything is aligned automatically to a particular aspect (left, center, or right).
Is there a way to ensure mobile styling so that it does not look so disjointed?
Thank you for your continued assistance,
Michael
For further context, here's how it looks in my application:
The columns look "zig-zagged" and disjointed. It would be ideal to have the image either fully left-aligned or centered, as well. Thank you again for any assistance.
Based on the reported problem, we would like to clarify that when using vertical row rendering mode, the grid will render only based on the <tr> element, which is responsible for rendering both the header text and row values. The content alignment is determined by the TextAlign property, meaning that if it is set to Right, both the header text and values will be aligned to the right. This is the default behavior. Please refer to the attached screenshot for your reference.
|
|
If you want proper alignment, we recommend that all Grid column text be
aligned consistently when using vertical mode. This helps avoid UI
appearance you shared . Kindly refer to the code snippet and sample below for
reference.
Code Snippet:
|
<GridFilterSettings Type="@Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings> <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="Syncfusion.Blazor.Grids.EditMode.Dialog"></GridEditSettings> <GridAggregates> <GridAggregate> <GridAggregateColumns> <GridAggregateColumn Field=@nameof(AdaptiveDetails.Model) Type="AggregateType.Count" Format="C2"> <FooterTemplate> @{ var aggregate = (context as AggregateTemplateContext); <div> <p>Total Models: @aggregate.Count</p> </div> } </FooterTemplate> </GridAggregateColumn> </GridAggregateColumns> </GridAggregate> </GridAggregates> <GridColumns> <GridColumn Field=@nameof(AdaptiveDetails.SNO) HeaderText="S NO" TextAlign="TextAlign.Right" HeaderTextAlign="TextAlign.Left" IsPrimaryKey="true" Width="150" ValidationRules="@(new Syncfusion.Blazor.Grids.ValidationRules { Required = true })"></GridColumn> <GridColumn Field=@nameof(AdaptiveDetails.Model) HeaderText="Model" TextAlign="TextAlign.Right" ValidationRules="@(new Syncfusion.Blazor.Grids.ValidationRules { Required = true })" Width="200"></GridColumn> <GridColumn Field=@nameof(AdaptiveDetails.Developer) HeaderText="Developer" TextAlign="TextAlign.Right" ValidationRules="@(new Syncfusion.Blazor.Grids.ValidationRules { Required = true })" FilterSettings="DeveloperFilterSettings" Width="200"></GridColumn> <GridColumn Field=@nameof(AdaptiveDetails.ReleaseDate) HeaderText="Released Date" TextAlign="TextAlign.Right" EditType="EditType.DatePickerEdit" Format="yyyyMMM" Width="200"></GridColumn> <GridColumn Field=@nameof(AdaptiveDetails.AndroidVersion) HeaderText="Android Version" TextAlign="TextAlign.Right" ValidationRules="@(new Syncfusion.Blazor.Grids.ValidationRules { Required = true })" FilterSettings="VersionFilterSettings" Width="200"></GridColumn> </GridColumns> </SfGrid>
|
UG: Adaptive
Layout in Blazor DataGrid Component | Syncfusion®
Hi Prathap,
OK thank you very much for taking the time to reply and guide. I will see if I can force the alignment on my side when set to mobile. I again appreciate your great support and patience as I continue to learn your controls.
Thank you,
Michael
Thanks for the update.
We are happy to hear that the provided information was helpful. We will now close this thread.
Hi Prathap,
Sorry to ressurect :D But I am now attending to this and have exactly what I want with the following:
```
.dragonspark-minimal.e-grid .e-rowcell.e-leftalign, .dragonspark-minimal.e-grid .e-rowcell.e-centeralign, .dragonspark-minimal.e-grid .e-rowcell.e-rightalign, .dragonspark-minimal.e-grid .e-headercell.e-leftalign, .dragonspark-minimal.e-grid .e-headercell.e-centeralign, .dragonspark-minimal.e-grid .e-headercell.e-rightalign, .dragonspark-minimal.e-grid .e-headercelldiv.e-leftalign, .dragonspark-minimal.e-grid .e-headercelldiv.e-centeralign, .dragonspark-minimal.e-grid .e-headercelldiv.e-rightalign { text-align: left !important; } .dragonspark-minimal.e-grid.e-row-responsive .e-gridcontent td::before, .dragonspark-minimal.e-grid.e-row-responsive .e-summarycontent td::before { left: 0 !important; padding-left: 0 !important; text-align: left !important; } .dragonspark-minimal.e-grid.e-row-responsive .e-gridcontent td.e-rowcell > div { padding-left: 10%; text-align: left !important; }
```
In particular is the `.dragonspark-minimal.e-grid.e-row-responsive .e-gridcontent td.e-rowcell > div`...
This works for everything but columns defined as such:
```
<Column T="TransactionEntry" Field=@nameof(TransactionEntry.AccountName) HeaderText="Account" AutoFit="true" />
```
These get generated as such:
<td class="e-rowcell e-ellipsistooltip e-leftalign" tabindex="0" role="gridcell" aria-colindex="2" data-sf-style="" data-cell="Account">Account #410F...D30C</td>
Note that there is no div there. Is there a way to target these with the above rules? I asked AI but it doesn't seem possible. Additionally, is there a way to ensure a div is emitted?
Thank you for your continued assistance.
Based
on the information provided, we understand that your requirement is to
left-align the Grid row elements on mobile devices using the CSS customization.
To achieve this, we recommend applying the following CSS customization. Kindly
refer to the code snippet and sample provided below for your reference.
Code Snippet:
|
<style> .e-bigger .e-grid td.e-rowcell{ text-align: left; } </style> |
Hi Prathap,
Thank you for your reply and pardon the confusion.
I also have the following CSS that I forgot to mention:
@media screen and (max-width: 576px) {
.e-grid.e-row-responsive .e-gridcontent td[data-cell],
.e-bigger .e-grid.e-row-responsive .e-gridcontent td[data-cell] {
padding-left: 12px !important;
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
}
.e-grid.e-row-responsive .e-gridcontent td[data-cell]::before,
.e-bigger .e-grid.e-row-responsive .e-gridcontent td[data-cell]::before {
position: relative !important;
display: block !important;
margin-bottom: 16px !important;
width: 100% !important;
}
.content-tab button.e-control.e-btn.button.fit {
overflow-x: auto !important;
white-space: nowrap !important;
background-image: linear-gradient(to right, rgba(255,255,255,0), rgba(0,0,0,0.2)) !important;
background-position: right center !important;
background-size: 24px 100% !important;
background-repeat: no-repeat !important;
background-attachment: scroll !important; /* 👈 Locks it right to the visible edge of the button! */
}
}
It results in the following:
Here's the markup used:
<Column T="Summary" Field=@nameof(Summary.Product) HeaderText="Product"> <Template Context="view"> <a rel='nofollow' href="@InventoryDetailsPath.Default.Get(view.Identity)">@view.Product</a> </Template> </Column> <Column T="Summary" Field=@nameof(Summary.Sales) HeaderText="Total/Sold/Remaining" Type="ColumnType.Integer" AllowSorting="false" AllowFiltering="false" AutoFit="true"> <Template Context="view"> <ContentView TValue="SummarySales" Content="@view.Sales" Context="sales"> <ChildContent>@sales.Total.ToString("N0")/@sales.Sold.ToString("N0")/@sales.Remaining.ToString("N0")</ChildContent> <NotFoundTemplate>N/A</NotFoundTemplate> </ContentView> </Template> </Column> <Column T="Summary" Field=@nameof(Summary.Created) HeaderText="Created" Type="ColumnType.DateTime" FilterSettings="@DateTimeFilterSettings.Default" AutoFit="true"> <Template Context="view"> <Starbeam.Presentation.Components.WhenTooltip When="@view.Created"/> </Template> </Column> <Column T="Summary" Field=@nameof(Summary.Views) HeaderText="Views" Type="ColumnType.Integer" TextAlign="TextAlign.Center" AutoFit="true" Format="N0"/> <Column T="Summary" Field=@nameof(Summary.Wanted) HeaderText="Wanted" Type="ColumnType.Integer" TextAlign="TextAlign.Center" AutoFit="true" Format="N0"/>
You can see the green use templates (good), but the red do not, resulting in raw text without a surrounding div (bad) I mentioned earlier.
Thank you for your continued assistance.
Thank you for the update.
Based on the markup you shared, we can see that some columns are rendered using Template content (for example, the Product, Total/Sold/Remaining, and Created columns), while others are standard bound columns (such as Views and Wanted).
In adaptive row rendering mode, template columns and non-template columns are rendered differently. Based on your description, the cells highlighted in green are using column templates and therefore generate their own HTML structure. In contrast, the cells highlighted in red are bound columns that render plain text content directly within the <td> element. As a result, these cells will not have the same wrapper element that is present for template-based content.
To validate and investigate this issue on our end, could you kindly provide the following details?
- A simple, reproducible sample that demonstrates the issue. Alternatively, you may modify the previously shared sample to reproduce the behavior.
- A screenshot highlighting the affected cells.
- The Syncfusion NuGet version you are currently using.
Once we receive these details, we will analyze the rendering behavior in greater detail and provide an appropriate solution. We look forward to hearing from you.
Hi Prathap,
Thank you for your reply and dialogue; they are appreciated. You have understood the problem perfectly.
- Templated columns do produce a container <div> element.
- Non-templated columns do not produce a container <div> element.
- Therefore, the following rule cannot be consistently applied to all columns generated by your control: ` .e-grid.e-row-responsive .e-gridcontent td.e-rowcell > div `
Thank you for the update.
Based on your explanation, we would like to clarify that the <div> wrapper surrounding the template column is the default behavior. As mentioned in your update, the CSS class .e-grid.e-row-responsive .e-gridcontent td.e-rowcell has been applied, and this styling affects all rows in the Grid. For your reference, we have attached a sample and screenshot demonstrating the current behavior.
Screenshot:
|
|
To help us validate and investigate the issue further, could you kindly provide the following details?
- Could you please explain the exact issue you are encountering when using the CSS classes you mentioned?
- Could you please share your specific requirement for applying these CSS classes?
- Please provide a simple, reproducible sample that demonstrates the issue. Alternatively, you may modify the previously shared sample to reproduce the behavior.
Once we receive these details, we will analyze the rendering behavior in greater detail and provide an appropriate solution. We look forward to hearing from you.
Hi Prathap,
Thank you so very much for your patience and for providing that sample. I was able to reproduce a very simple example here:
https://blazorplayground.syncfusion.com/LjVRZbDgJumUwCvg
You can see that the normal column does not pad right (red) while the templated column does pad right (green):
If you are able to provide rules/styling so that the normal pads exactly like templated, I would greatly appreciate it.
Thank you again for your amazing assistance and support!
Michael
Thanks
for the update,
Based on your requirement, we would like to clarify that the CSS is applied to
the template column but not to the normal column because the template column
contains a child <div> element, whereas the normal column does not. This
is the default behavior of the component. As a result, the CSS is applied only
to the template column cells and not to the normal column cells. To achieve
your requirement, we recommend using the solution provided below based on your
specific needs. Kindly refer to the following code snippet and sample for your
reference.
|
<style> .e-bigger .e-grid td.e-rowcell { text-align: left !important; }
.e-grid.e-row-responsive .e-gridcontent td[data-cell]::before, /* Header (Label generated from data-cell via ::before) */ .e-bigger .e-grid.e-row-responsive .e-gridcontent td[data-cell]::before { position: relative !important; display: block !important; width: 100% !important; margin-bottom: 16px !important; text-align: left !important; right: 32px; left: unset; }
.e-grid.e-row-responsive .e-gridcontent td[data-cell], /* Cell Content */ .e-bigger .e-grid.e-row-responsive .e-gridcontent td[data-cell] { padding-left: 10% !important; width: 100% !important; box-sizing: border-box !important; }
.e-grid.e-row-responsive .e-gridcontent td.e-rowcell { background-color: aquamarine; color: blue; } </style>
|
Awesome! Yes, thank you so very much Prathap! Wow that is exactly what was needed. Css isn't much of a strong suit and even AI was getting confused and couldn't help here. I greatly appreciate again your patience and valuable feedback to help me get situated. 🙏
Here is my final CSS:
.dragonspark-minimal.e-grid .e-rowcell.e-leftalign, .dragonspark-minimal.e-grid .e-rowcell.e-centeralign, .dragonspark-minimal.e-grid .e-rowcell.e-rightalign, .dragonspark-minimal.e-grid .e-headercell.e-leftalign, .dragonspark-minimal.e-grid .e-headercell.e-centeralign, .dragonspark-minimal.e-grid .e-headercell.e-rightalign, .dragonspark-minimal.e-grid .e-headercelldiv.e-leftalign, .dragonspark-minimal.e-grid .e-headercelldiv.e-centeralign, .dragonspark-minimal.e-grid .e-headercelldiv.e-rightalign, .dragonspark-minimal.e-grid.e-row-responsive .e-gridcontent td[data-cell] .text-center { text-align: left !important; } .dragonspark-minimal.e-grid.e-row-responsive .e-gridcontent td::before, .dragonspark-minimal.e-grid.e-row-responsive .e-summarycontent td::before { left: -7% !important; } .dragonspark-minimal.e-grid.e-row-responsive .e-gridcontent td[data-cell]:not(:has(img)) { padding-left: 10% !important; }
Pretty simple once all is done. Thank you again for your tremendous support!
Thanks for the update.
We are glad to hear that the suggested CSS solution worked perfectly for your requirement. We will now close this thread.