以下のコードはうまく動作し、すべてのデータを取得します。私はいくつかのフィルタ文字列をデータテーブル(sample_container)に挿入したいと思います。したがって、sample_appを指定すると、ページが読み込まれたときにsample_containerデータテーブル用のいくつかのフィルタ文字列(filter1、filter2)を使用して自動的にフィルタをかけたいとします。何か案は?Jqueryのデータ型の文字列フィルタ
$("#sample_container").html("<h2>Sample libs</h2>");
$.ajax({
type: "GET",
url: "some_url",
data: some_data,
dataType: 'jsonp',
crossDomain: true,
async: false,
success: function(response) {
$("#sample_container").html("<h2>Sample Libraries</h2>");
html = "<table class='datatable'>";
blah blah
}
html += "</table>";
$("#sample_container").append(html);
$("#sample_container .datatable").dataTable({ "bPaginate": false,
"bAutoWidth": false,
"bFilter": false,
"bInfo": false
}).columnFilter({ sPlaceHolder: "head:after",
aoColumns: [ { type: "text" },
{ type: "text" },
{ type: "text" }
]
});
},
});
{% if sample_app %}
<h1>{{ sample_app.id }} - {{ sample_app.name }}</h1>
<br/>
blah blah...
{% endif %}