0

I have a table with a right fixed column and there are 6 columns on the left with an x-scroll. I used code similar to this

how do I create an HTML table with fixed/frozen left column and scrollable body?

This works for the most part, however this is on a responsive site, so when you scale down the page the right fixed column pushed over until about 400px and then starts to overlap the columns on the left. I applied a white background to the <td> but I would like for the right column just to force the other column to become hidden in the scroll, all the way down to the lowest browser width. Any ideas!

https://jsfiddle.net/TBankston/5L7jkbfq/

<div class="page-header">
    <h3>Charity</h3>
</div>
<div class="table-responsive">
    <table cellpadding="9" class="table-hover">
        <thead>
            <tr>
                <th>
                    @Html.DisplayNameFor(model => model.ID)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.EventName)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Organization)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.District)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Hours)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Donation)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.TotalValue)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.ModifiedDate)
                </th>
                <th class="crud-links"> Options</th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.ID)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.EventName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Organization)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.District)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Hours)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Donation)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.TotalValue)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ModifiedDate)
                </td>
                <td class="crud-links">
                    @Html.ActionLink("Details", "Details", new { id = item.ID })
                    @if (ViewBag.current_User.CanEdit())
                    {
                        <span>|</span>
                        @Html.ActionLink("Edit", "Edit", new { id = item.ID })
                        <span>|</span>
                        @Html.ActionLink("Delete", "Delete", new { id = item.ID })
                    }
                </td>
            </tr>
        }
    </table>
    <table>
        <tr>

        </tr>
    </table>
</div>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
TBankston
  • 45
  • 1
  • 8
  • Share your code in the jsfiddle.. basic rule of stackoverflow is no code, no solution – Rajesh kannan Sep 15 '15 at 03:42
  • What would you like it to do? – Adam Buchanan Smith Sep 15 '15 at 16:33
  • Adam: I would like the columns on the right to act as a separate table with the x-scroll. I want the right column to remain completely fixed to the right. The left columns should scale down while the right column remains the same width and doesn't overlap the left columns no matter the browser width. – TBankston Sep 15 '15 at 16:45

0 Answers0