0
jQuery jTableを使用して新規です。fieldset、jtable、およびjavaサーブレットにオプションを追加すると列全体が表示されない
jTableフィールドセットの1つにドロップボックスを追加したいとします。 Dropboxを追加する前に、フィールドセットの内容が正しく表示されていました。しかし、データベースからDropboxリストを取得する関数をサーブレット経由で追加すると、列全体が表示されなくなります。私のフィールドセットのオプションパラメータを追加する前と後の私のテーブルの印刷画面です。私は.js
と私のサーブレットの一部を投稿しています。私が追加したDropboxは正常に動作しています!
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HashMap<String,String> data = new HashMap<String,String>();
try {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
/** Code removed purposefully */
// Convert array list to string
String myoptionList = gson.toJson(typeOfProfile);
// Return in the format required by jTable plugin
data.put("Result", "OK");
data.put("Options",myoptionList);
response.setContentType("application/json");
response.getWriter().write(gson.toJson(data));
} catch (Exception ex) {
data.put("Result", "ERROR");
data.put("Message", ex.getMessage());
String error = gson.toJson(data);
response.getWriter().print(error);
}
//}//end of if statement --if req--
}
、ここで私のJavaのscripteコード(jqueryの)
labelProfile : {
title : 'Type Profile',
width : '10%',
edit : true,
options: function() {
var options = [];
var toSearch = "salut!" //this is just for testing dont mind this
if (cachedValue) { //Check for cache
return cachedValue;
}
$.ajax({ //If the cache is empty execute the following
type: "POST",
url: 'showProfileOptions',
dataType: 'json',
data:{toSearch:toSearch},
async: false,
success:function(data){
if(data.Result != 'OK'){
alert(data.Message)
return;
}
options = jQuery.parseJSON(data.Options);
}
});
return cachedValue = options;
}//end function
そして最後に、テーブルの印刷画面を前にして、フィールドセット内のオプションを追加した後です。
-
私はDropboxのを入れていない
(data.source == 'list')
かのような条件を追加してみました。
アドバイスはありますか?
コードを正しく再構成すると、 'if' elseの '{}'が一致しません。 – Samundra