我正在使用帶有「幻燈片放映」效果的jQuery jTable,因此每次單擊一個選項卡時,它都會帶來「幻燈片放映」過渡中的數據。不過,我最近關閉了jQuery jTable中的「分頁」功能,並從那時起,「幻燈片」轉換卡在中間,同時發出以下消息「無數據可用」,一旦轉換完成,數據。jQuery jTable關閉分頁導致問題
非常奇怪..它在中間被卡住的很糟糕,並且在轉換完成後它只帶來了數據並且是一個主要問題。
有沒有什麼辦法可以在它帶來數據之前進行ajax加載?或者我可以使用任何其他轉換而不是「滑入」?
我從本地Excel文件中提取數據。任何幫助,高度讚賞:)
幻燈片過渡代碼:
$(document).on('click', '.PlayStatisticClass', function (e) {
var $marginLefty = $("div[class='" + this.id + " win-ui-dark slide']")
if (!$marginLefty.hasClass('slide in')) {
if (this.id === "PlayStatisticone" || this.id === "PlayStatistictwo" || this.id === "PlayStatisticthree" || this.id === "PlayStatisticfour" || this.id === "PlayStatisticfive"
|| this.id === "PlayStatisticsix" || this.id === "PlayStatisticseven" || this.id === "PlayStatisticeight" || this.id === "PlayStatisticnine") {
$marginLefty.addClass('registrationFormSlideIn').css('width', "");
}
else {
}
}
else {
$marginLefty.removeClass('slide in').addClass('slide').css('width', 0);
}
});
JTable中查看代碼:如果我關掉分頁:
$(document).ready(function() {
$('#TopPlayedTracksContainer1').jtable({
title: 'Top Played Genres List',
paging: false,
pageSize: 1,
sorting: true,
defaultSorting: 'NoOfPlays DESC',
actions: {
listAction: '@Url.Action("BilingReportList")'
},
fields: {
TrackID: {
title: 'Track ID',
tooltip: 'Track ID'
},
TrackName: {
title: 'Track Name',
tooltip: 'Track Name',
key: true,
create: false,
edit: false,
resize: false,
},
ArtistName: {
title: 'Artist Name',
tooltip: 'Artist Name'
},
Times: {
title: 'Times',
tooltip: 'Times'
},
}
});
$('#TopPlayedTracksContainer1').jtable('load');
});
控制器代碼:從本地獲取數據excel文件:
public JsonResult BilingReportList(int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
{
try
{
if (Request.IsAuthenticated == true)
{
string Path = @"C:\\5Newwithdate.xls";
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= '" + Path + "';Extended Properties=" + (char)34 + "Excel 8.0;IMEX=1;" + (char)34 + "");
OleDbDataAdapter da = new OleDbDataAdapter("select * from [Sheet1$]", con);
System.Data.DataTable data = new System.Data.DataTable();
da.Fill(data);
con.Close();
List<TopPlayed> daa = new List<TopPlayed>();
foreach (DataRow p in data.Rows)
{
TopPlayed top = new TopPlayed()
{
TrackID = Convert.ToInt32(p.Field<double>("ID")),
TrackName = p.Field<string>("Track Name"),
ArtistName = p.Field<string>("Artist Name"),
Times = Convert.ToInt32(p.Field<double>("NoOfPlays"))
};
daa.Add(top);
}
var newlist = daa.OrderByDescending(i => i.Times).ToList();
return Json(new { Result = "OK", Records = newlist, TotalRecordCount = daa.Count });
}
return Json(new { Result = "ERROR" });
}
catch (Exception ex)
{
return Json(new { Result = "ERROR", Message = ex.Message });
}
}
沒有人知道爲什麼會這樣不斷髮生?請.. – pv619