Javascript 未捕获类型错误:无法读取属性';数据';未定义jquery Jtable的

Javascript 未捕获类型错误:无法读取属性';数据';未定义jquery Jtable的,javascript,jquery,asp.net-mvc,jquery-ui,jquery-jtable,Javascript,Jquery,Asp.net Mvc,Jquery Ui,Jquery Jtable,我已经为这个问题调查了12个多小时,没有任何解决方案的线索。我对jtable有很好的了解,而且我已经使用它很长时间了。我有一个普通的div,我想用jtable构建它,所以我从我的应用程序中的一个旧的工作示例中复制了代码并对其进行了编辑,但是控制台中出现了一个javascript错误,它阻止了数据显示在表中: 未捕获的TypeError:无法读取未定义jquery Jtable的属性“data” 这是我的html页面: @model Tuple<List<SIO.Core.Entiti

我已经为这个问题调查了12个多小时,没有任何解决方案的线索。我对jtable有很好的了解,而且我已经使用它很长时间了。我有一个普通的div,我想用jtable构建它,所以我从我的应用程序中的一个旧的工作示例中复制了代码并对其进行了编辑,但是控制台中出现了一个javascript错误,它阻止了数据显示在表中:

未捕获的TypeError:无法读取未定义jquery Jtable的属性“data”

这是我的html页面:

@model Tuple<List<SIO.Core.Entities.Group>, List<SIO.Core.Entities.WorkFlow>>
@section JavaScript
{

<script type="text/javascript" src="@Url.Content("/Scripts/GroupHandler.js")"></script>
<script type="text/javascript" src="@Url.Content("/Scripts/jquery-ui.js")"></script>
<script type="text/javascript"      src="@Url.Content("/Scripts/jquery.jtable.js")"></script>

}


@{
ViewBag.Title = "المجموعات";
Layout = "~/Views/Shared/_Layout.cshtml";
}



<div id="divBackgroundtask" style="display: none;">
</div>
<div id="indx_divtask">
    <section class="col-md-8 taskPoolfilterSection">

    <div class="form-group">
        <div class="border-top">
        </div>
        <div id="filter" class="panel-body margin-bottom">
            <header class="panel-heading containt-border">
                @ViewBag.Title
            </header>
        </div>


    </div>

    <!-- /.panel-body -->


    <div id="divPleaseWaittask" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="load_div col-sm-offset-2 col-sm-5">
            <div class="  row col-sm-2 col-sm-offset-9">
                <img src="~/Images/Loading.gif" />
            </div>

            <div class="row col-sm-12 txt_wait">
                <b>برجاء الإنتظار حتى إكمال العملية</b>
            </div>
        </div>

    </div>



</section>

<div id="GroupsContainer" class="table-responsive">

</div>
这是导致错误的行:

 $dfd.resolve(data);
下面是我检索记录的操作方法:

[HttpGet]
        public JsonResult GetAllGroups(int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null, string rangeSt = "", string rangeEd = "")
        {
            try
            {
                LogHelpper.LogMessage("GroupContorller GetAllSystemUsers Post Method Started", EventLogEntryType.Information, log);

                GroupManager groupManager = new GroupManager();
                List<Group> groups = groupManager.SkipAndTake(jtStartIndex, jtPageSize);
                List<GroupCustomViewModel> groupCustomViewModel = groups.Select(group => new GroupCustomViewModel(group)).ToList();

                LogHelpper.LogMessage("GroupContorller GetAllGroups Post Method Ended", EventLogEntryType.Information, log);





                return Json(new { Result = "OK", Records = groupCustomViewModel , TotalRecordCount = groupCustomViewModel .Count }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                LogHelpper.LogMessage("Error Message", EventLogEntryType.Error, log);
                LogHelpper.LogException(ex, EventLogEntryType.Error, log);
                return Json(new { Result = "ERROR", Message = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
[HttpGet]
public JsonResult GetAllGroups(int-jtStartIndex=0,int-jtPageSize=0,string-jtSorting=null,string-rangeSt=“”,string-ranged=“”)
{
尝试
{
LogHelper.LogMessage(“GroupContorller GetAllSystemUsers Post方法已启动”,EventLogEntryType.Information,log);
GroupManager GroupManager=新的GroupManager();
列表组=groupManager.SkipAndTake(jtStartIndex,jtPageSize);
列出groupCustomViewModel=组。选择(组=>new groupCustomViewModel(组)).ToList();
LogHelper.LogMessage(“GroupContorller GetAllGroups Post方法已结束”,EventLogEntryType.Information,log);
返回Json(新的{Result=“OK”,Records=groupCustomViewModel,TotalRecordCount=groupCustomViewModel.Count},JsonRequestBehavior.AllowGet);
}
捕获(例外情况除外)
{
LogHelpper.LogMessage(“错误消息”,EventLogEntryType.Error,log);
LogHelpper.LogException(例如,EventLogEntryType.Error,log);
返回Json(新的{Result=“ERROR”,Message=ex.Message},JsonRequestBehavior.AllowGet);
}
}
这是我的模型:

public class GroupCustomViewModel
    {
        #region properties
        /// <summary>
        /// Gets or sets the GoupIDPK.
        /// </summary>
        /// <value>The GoupIDPK.</value>
        public int GoupIDPK { get; set; }
        /// <summary>
        /// Gets or sets the GroupName.
        /// </summary>
        /// <value>The GroupName.</value>

        public string GroupName { get; set; }
        /// <summary>
        /// Gets or sets the GroupDisc.
        /// </summary>
        /// <value>The GroupDisc.</value>
        public string GroupDisc { get; set; }

        public string EditHyperlink { get; set; }

        public string DeleteHyperlink { get; set; }

        public string DetalisHyperlink { get; set; }

        public bool DefaultGroup { get; set; }
        #endregion
    }
公共类GroupCustomViewModel
{
#区域属性
/// 
///获取或设置GoupIDPK。
/// 
///GoupIDPK。
公共int GoupIDPK{get;set;}
/// 
///获取或设置组名。
/// 
///组名。
公共字符串组名{get;set;}
/// 
///获取或设置GroupDisc。
/// 
///组光盘。
公共字符串GroupDisc{get;set;}
公共字符串编辑超链接{get;set;}
公共字符串DeleteHyperlink{get;set;}
公共字符串{get;set;}
public bool DefaultGroup{get;set;}
#端区
}
抱歉,如果问题太长,但我不知道错误在哪里,所以我
发布了执行该任务所需的所有代码。

最后我找到了问题所在。。。在jTable definition at fields部分
ID
中,但是模型字段名是GroupIDPK,所以将jTable字段
ID
更改为
GroupIDPK
解决了问题

最后我找到了问题所在。。。在jTable definition at fields部分
ID
中,但是模型字段名是GroupIDPK,因此将jTable field
ID
更改为
GroupIDPK
解决了问题

您能指出发生错误的行吗?那会有帮助的。你能指出错误发生在哪一行吗?那会有帮助的。
public class GroupCustomViewModel
    {
        #region properties
        /// <summary>
        /// Gets or sets the GoupIDPK.
        /// </summary>
        /// <value>The GoupIDPK.</value>
        public int GoupIDPK { get; set; }
        /// <summary>
        /// Gets or sets the GroupName.
        /// </summary>
        /// <value>The GroupName.</value>

        public string GroupName { get; set; }
        /// <summary>
        /// Gets or sets the GroupDisc.
        /// </summary>
        /// <value>The GroupDisc.</value>
        public string GroupDisc { get; set; }

        public string EditHyperlink { get; set; }

        public string DeleteHyperlink { get; set; }

        public string DetalisHyperlink { get; set; }

        public bool DefaultGroup { get; set; }
        #endregion
    }