我的网站中的表有很多列,我找到了BootstrapTable,所以我有一个使用jquery resize事件的函数。当窗口等于或小于887px时,它应该将表更改为卡片视图。但是当我运行该网站时,我收到一个错误告诉我这个
0x800a01b6 - JavaScript运行时错误:对象不支持属性或方法' bootstrapTable'
任何人都可以解释为什么我会收到此错误以及如何解决此错误。这是我的代码。感谢
此代码位于我的母版页中 此代码位于标头标记
中<link href="Styles/1Life/jquery-ui.min.css" rel="stylesheet" />
<link href="Styles/1Life/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../Styles/1Life/bootstrap-table.min.css" rel="stylesheet" type="text/css" />
<link href="Styles/1Life/1Life_StyleSheet.css" rel="stylesheet" type="text/css" />
此代码位于正文标记
中 <asp:ToolkitScriptManager ID="ToolScriptManager1" runat="server" EnablePageMethods="true" AsyncPostBackTimeout="0">
<Scripts>
<asp:ScriptReference Path="~/Scripts/JQuery/1Life/jquery-1.12.3.min.js" />
<%--<asp:ScriptReference Name="jquery" Path="~/Scripts/jquery-2.2.3.min.js" />--%>
<asp:ScriptReference Path="~/Scripts/JQuery/jquery-ui.min.js" />
<asp:ScriptReference Path="~/Scripts/JQuery/jquery-migrate-1.3.0.js" />
<asp:ScriptReference Path="~/Scripts/JQuery/animatedcollapse.js" />
<asp:ScriptReference Path="~/Scripts/js/CommonFunctions.js" />
<asp:ScriptReference Path="~/Scripts/js/bootstrap.min.js" />
<asp:ScriptReference Path="~/Scripts/js/bootstrap-table.min.js" />
<asp:ScriptReference Path="~/Scripts/js/InboundSales.js" />
</Scripts>
</asp:ToolkitScriptManager>
这是javascript
function changinggrvWorkbenchToCardView() {
if ($(window).width() <= 887) {
$("#ContentPlaceHolder1_grvWorkbench").removeAttr("data-card-view");
$("#ContentPlaceHolder1_grvWorkbench").attr("data-toggle", "table");
$("#ContentPlaceHolder1_grvWorkbench").attr("data-card-view", "true");
$("#ContentPlaceHolder1_grvWorkbench").bootstrapTable('resetView');
}
else if ($(window).width() > 887) {
$("#ContentPlaceHolder1_grvWorkbench").removeAttr("data-toggle");
$("#ContentPlaceHolder1_grvWorkbench").removeAttr("data-card-view");
$("#ContentPlaceHolder1_grvWorkbench").attr("data-card-view", "false");
$("#ContentPlaceHolder1_grvWorkbench").bootstrapTable('resetView');
}
}
这是表格
<asp:GridView ID="grvDiaryEntries" runat="server" AutoGenerateColumns="False" Width="95%" GridLines="None" AllowPaging="True" CssClass="GridStyle marginLeft3 table grvRefresh" OnRowCommand="grvDiaryEntries_RowCommand" DataKeyNames="DiaryKey" OnPageIndexChanging="grvDiaryEntries_PageIndexChanging" PageSize="15" ClientIDMode="Static" CellPadding="4" ForeColor="#333333" data-card view="false">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField ShowHeader="true" HeaderText="Reference Number">
<ItemTemplate>
<asp:LinkButton ID="lnkLeadNumber" runat="server" CausesValidation="False" CommandName="Select"
OnClientClick='<%# "OpenDiaryEntry(\""+ Eval("DiaryKey")+"\",\""+ Eval("Operator")+"\"); return false;" %>'
Text='<%# Eval("ReferenceNumber") %>' ToolTip="View diary entry details"></asp:LinkButton>
</ItemTemplate>
<ItemStyle Width="15%" />
</asp:TemplateField>
<asp:BoundField DataField="Operator" HeaderText="Operator" Visible="False" />
<asp:TemplateField HeaderText="Text">
<ItemTemplate>
<asp:Label ID="lblText" runat="server" Text='<%# Eval("Text").ToString().Length < 50 ? Eval("Text") : Eval("Text").ToString().Substring(0,49) + "..." %>'>></asp:Label>
</ItemTemplate>
<ItemStyle Width="50%" />
</asp:TemplateField>
<asp:BoundField DataField="DiaryDate" HeaderText="Diary Date" />
<asp:TemplateField HeaderText="Options">
<ItemTemplate>
<asp:LinkButton ID="lnkComplete" runat="server" CausesValidation="False" CommandName="Complete"
Text='Complete' OnClientClick="return confirm('Are you sure you want to complete this Diary Entry?'); return false;"
ToolTip="Mark this diary entry as complete" CommandArgument='<%# Eval("DiaryKey").ToString() %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" Visible="False">
<ItemTemplate>
<asp:LinkButton ID="lnkView" runat="server" CausesValidation="False" CommandName="Select"
OnClientClick='<%# "OpenView(\""+ Eval("DiaryKey")+"\",\""+ Eval("Operator")+"\"); return false;" %>'
Text="View" ToolTip="View"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#2461BF" />
<EmptyDataRowStyle HorizontalAlign="Center" />
<EmptyDataTemplate>
<span style="color: red;">THERE IS NO DATA AVAILABLE TO DISPLAY</span>
</EmptyDataTemplate>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle HorizontalAlign="Center" BackColor="#2461BF" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>