JSには少し新しく、なんらかのものがあります。私は、私のjsonのデータと場所をテーブルに取得し、dynatable.jsを統合しようとするajaxリクエストを持っていますが、必要に応じてこれを行う最善の方法はありません。ajax json callとdynatable-jqueryをマージする
現在のJS:
$(function() {
'use strict';
//global
var current_file_index = 0;
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: 'server/php/',
prependFiles:true
}).on('fileuploadsubmit', function (e, data) {
//data.formData = {date: data.files[0].date};
data.formData = data.context.find(':input').serializeArray();
});
// Load existing files:
$('#fileupload').addClass('fileupload-processing');
$.ajax({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: $('#fileupload').fileupload('option', 'url'),
dataType: 'json',
context: $('#fileupload')[0],
prependFiles:true,
}).always(function() {
$(this).removeClass('fileupload-processing');
}).done(function (result) {
$(this).fileupload('option', 'done').call(this, $.Event('done'), {result: result});
});
});
Dynatable JS:私は一緒に両方それらを使用する場合は
$('#remote').dynatable({
dataset: {
ajax: true,
ajaxOnLoad: true,
ajaxUrl: '/server/php/index.php',
files: []
}
});
私が取得:
Uncaught TypeError: Cannot read property 'length' of null at Records.count (jquery.dynatable.js:694) at RecordsCount.create (jquery.dynatable.js:708) at RecordsCount.attach (jquery.dynatable.js:734) at RecordsCount.init (jquery.dynatable.js:704) at Object.build (jquery.dynatable.js:186) at Object.init (jquery.dynatable.js:142) at HTMLTableElement. (jquery.dynatable.js:1673) at Function.each (jquery.min.js:2) at n.fn.init.each (jquery.min.js:2) at n.fn.init.$.fn.dynatable (jquery.dynatable.js:1671)
私は、次の操作を行う場合は、一種のが、作品私はテーブルをソートしようとすると、それがajaxを介して読み込まれているすべてのデータを削除します... littl説明するのは難しい。しかし、シェルでは、私は彼らが一緒に働くようにそれらをよりよく統合する必要があると思う。
$( '#remote')。dynatable();
私は、以下のセットアップこのためのソリューションを望む人のために、この
を問題は何ですか?どこかに質問がありますか? –
両方を一緒に使用するとエラーが発生するようです:Uncaught TypeError:nullのプロパティ 'length'を読み取ることができませんRecord.count(jquery.dynatable.js:694) at RecordCount.create(jquery.dynatable.js: 734) RecordsCount.initで(jquery.dynatable.js:704) Object.buildで(jquery.dynatable.js:186) Object.initで(RecordsCount.attach(jquery.dynatable.jsにおける708) jquery.dynatable.js:142) at HTMLTableElement。(jquery.dynatable.js:1673) Function.each(jquery.min.js:2) at n.fn.init.each(jquery.min.js:2) –
James
あなたはjsonの応答を得る? –