Jtable不会加载

时间:2016-08-22 19:01:32

标签: jquery-jtable

我正在尝试加载一个简单的jtable,但不是加载jtable而是继续重新加载我的页面而不显示错误消息。它永远不会成为我的“GetPalletListing”方法。

以下是我认为的内容

<fieldset>
    <legend>Job Info</legend>

    <div style="width: 75%; float:left">
        @Html.Label("jobRelease", "Job Release", new { @class = "w110px", @style="margin-right:10px" })
        <br />
        @Html.TextBox("jobReleaseNumber", (string)ViewBag.JobRelNum, new { @class="w110px", data_validation_engine = "validate[required, minSize[9], maxSize[9]]", @style="margin-right:10px", onchange="UpdateGrid();" })        
    </div>
        <br /><br /><br /><br />
    <div id="PalletListingContainer"></div>
    </fieldset>    
    <br />

<script type="text/javascript">
    $(document).ready(function () {
        // Pallet Listing JTable
        $('#PalletListingContainer').jtable({
            title: 'Pallet Listing',
            paging: true,
            pageSize: 10,
            actions: {
                listAction: '/Pallet/GetPalletListing'
            },
            fields: {
                PalletID: {
                    key: true,
                    type: 'hidden'
                },
                PalletNumber: {
                    title: 'Number',
                    width: '10%'
                },
                PieceCount: {
                    title: 'Pieces',
                    width: '10%'
                },
                PalletType: {
                    title: 'Type',
                    width: '20%'
                },
                PalletWeight: {
                    title: 'Wgt',
                    width: '15%'
                },
                PackedDate: {
                    title: 'Packed',
                    width: '15%',
                    type: 'date'
                },
                ClosedDate: {
                    title: 'Closed',
                    width: '15%',
                    type: 'date'
                },
                ShipDate: {
                    title: 'Shipped',
                    width: '15%',
                    type: 'date'
                }
            }
        });

        //UpdateGrid();
    });

    function UpdateGrid() {
        // Load Scheduled Jtable
        $('#PalletListingContainer').jtable('load', {
            jobNo: $('#jobReleaseNumber').val()
        });
    }

</script>

<script src="~/Scripts/jtable/jquery.jtable.min.js" type="text/javascript"></script> 
<link href="~/Scripts/jtable/themes/lightcolor/blue/jtable.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery.maskedinput-1.3.1.min.js"></script>

这是我的控制器

using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PalletManager.Models;

namespace PalletManager.Controllers
{
   [Authorize]
    public class PalletController : Controller
    {
        #region View Methods

        [AllowAnonymous]
        public ActionResult PalletList(string jobReleaseNumber)
        {
            ViewBag.JobRelNum = jobReleaseNumber;
            return View();
        }

        #endregion

        #region Public Methods
        #endregion

        #region J-Table Methods

        [HttpPost]
        public JsonResult GetPalletListing(string jobNo, int jtStartIndex, int jtPageSize)
        {
            try
            {
                List<PalletRepository.PalletListSummary> results = null;
                using (PalletRepository palRepo = new PalletRepository())
                {
                    //results = palRepo.GetPalletList(jobReleaseNumber);
                }
                return Json(new { Result = "OK", Records = results.Skip(jtStartIndex).Take(jtPageSize), TotalRecordCount = results.Count }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { Result = "ERROR", Message = ex.Message });
            }
        }


        #endregion
    }
}

0 个答案:

没有答案