이것은 mVC C#을 사용하여 JTable을 처음 사용한 것입니다. my JsonResult Action이 올바른 JSon 데이터를 반환하지만 내보기에서 jtable로 변환되지 않고 원시 JSON 데이터가 표시됩니다.JsonResult는 올바른 JSon을 반환하지만보기에서 jtable을 만들 수 없습니다. mvc no error given
으로보기에 내 코드입니다 : 나는 또한 파일 script.js 내가 제거한
$('#IndividualRecords').jtable('load');
- 을 시도하고 이유가 있는지 확인하기 위해 페이지에 코드를 이동
@{ ViewBag.Title = "Individual Records Json"; } <h2>Individual Matters</h2> <div id="IndividualRecords"></div> @section scripts{ <!--Adding Theme for jTable Grid--> <!--You can choose any type of theme from the themes folder--> <link href="~/Scripts/jtable/themes/metro/blue/jtable.min.css" rel="stylesheet" /> @*<link href="~/Content/themes/base/jquery-ui.css" rel="stylesheet" />*@ <link href="http://jtable.org/Content/themes/metroblue/jquery-ui.css" rel="stylesheet" type="text/css" /> <script src="~/Scripts/jquery-ui-1.9.2.min.js"></script> <!--Adding jTable Plugin--> <script src="~/Scripts/jtable/jquery.jtable.min.js"></script> <!--Adding our script file--> @*<script src="~/Scripts/Script.js"></script>*@ } <script language="JavaScript"> $(document).ready(function() { $('#IndividualRecordJson').jtable( { title: 'Individual Recordss', actions: { listAction: '/Dashboard/_IndividualRecord_Json', createAction: '/Dashboard/_IndividualRecord_Json', updateAction: '/Dashboard/_IndividualRecord_Json', deleteAction: '/Dashboard/_IndividualRecord_Json', }, fields: { RecordCode: {title: 'Record Code', width: '15%'}, RecordType: {title: 'Record Type', width: '15%'}, ClientName: {title: 'Client Name', width: '15%'}, Description: {title: 'Description', width: '15%'}, Cost: {title: 'Cost', width: '15%'} } } ); $('#IndividualRecords').jtable('load'); }); </script> <body> <h2>This is a test line for nothing</h2> <div id="IndividualRecords">My data will come here.... some time...</div> </body>
.
- 보안상의 이유로 필드 이름이 변경되었습니다. 필드 이름은 이미 적절한 경우입니다.
- [httpget]을 (를) 사용 중입니다.
- 내가 대신 [HttpPost] 시도 MVC 버전 4.0.3xxx
테스트 목적으로 만 목록이 필요합니다. 모든 작업에 대해 동일한 작업을 추가했습니다. –
수정 : $ ('# IndividualRecords'). jtable ('reload'); –