Merge pull request #625 from bjarnef/dev-v7-U4-4418

U4-4418 - fix issue with tab sorting
This commit is contained in:
Shannon Deminick
2015-02-13 11:13:46 +11:00
2 changed files with 30 additions and 4 deletions

View File

@@ -25,18 +25,18 @@
<cc2:Pane ID="Pane1" runat="server" Width="216" Height="80">
<asp:DataGrid ID="dgTabs" Width="100%" runat="server" CellPadding="2" HeaderStyle-CssClass="propertyHeader"
ItemStyle-CssClass="propertyContent" GridLines="None" OnItemCommand="dgTabs_ItemCommand"
ItemStyle-CssClass="propertyContent" GridLines="None" OnItemCommand="dgTabs_ItemCommand" OnItemDataBound="dgTabs_ItemDataBound" OnPreRender="dgTabs_PreRender"
HeaderStyle-Font-Bold="True" AutoGenerateColumns="False" CssClass="tabs-table">
<Columns>
<asp:BoundColumn DataField="id" Visible="False"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Name & sort order">
<ItemTemplate>
<i class="icon-navigation handle"></i>
<i class="icon-navigation handle" style="display:inline-block; margin-top:5px;"></i>
<asp:TextBox ID="txtTab" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"name")%>'></asp:TextBox>
<asp:TextBox ID="txtSortOrder" runat="server" CssClass="sort-order" style="width:40px;background-color:#f2f2f2;" Value='<%#DataBinder.Eval(Container.DataItem,"order") %>'></asp:TextBox>
<asp:Button ID="btnDelete" runat="server" Text="Delete" CommandName="Delete" CssClass="btn btn-small btn-danger" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:ButtonColumn ButtonType="PushButton" Text="Delete" CommandName="Delete"></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
<p style="text-align: center;">

View File

@@ -28,6 +28,32 @@ namespace Umbraco.Web.UI.Umbraco.Controls
DataTypeControllerUrl = Url.GetUmbracoApiServiceBaseUrl<DataTypeController>(x => x.GetById(0));
ContentTypeControllerUrl = Url.GetUmbracoApiServiceBaseUrl<ContentTypeController>(x => x.GetAssignedListViewDataType(0));
}
protected void dgTabs_PreRender(object sender, EventArgs e)
{
dgTabs.UseAccessibleHeader = true; //to make sure we render th, not td
Table table = dgTabs.Controls[0] as Table;
if (table != null && table.Rows.Count > 0)
{
// here we render <thead> and <tfoot>
if (dgTabs.ShowHeader)
table.Rows[0].TableSection = TableRowSection.TableHeader;
if (dgTabs.ShowFooter)
table.Rows[table.Rows.Count - 1].TableSection = TableRowSection.TableFooter;
}
}
protected void dgTabs_ItemDataBound(object sender, DataGridItemEventArgs e)
{
Table table = dgTabs.Controls[0] as Table;
if (table != null && table.Rows.Count > 0)
{
if (dgTabs.ShowHeader)
table.Rows[0].TableSection = TableRowSection.TableHeader;
if (dgTabs.ShowFooter)
table.Rows[table.Rows.Count - 1].TableSection = TableRowSection.TableFooter;
}
}
}
}