下面的代碼工作得很好,並獲取所有的數據。我想在數據表中插入一些過濾器字符串(sample_container)。因此,對於給定的sample_app,想要在加載頁面時自動使用某些過濾器字符串(filter1,filter2)爲sample_container數據表進行過濾。有任何想法嗎?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 %}