이 문제점을 해결하는 데 문제가 있습니다. 그래서 나는 검색 기능, 데이터 버튼을 새로 고침하고 대화 상자 안에 DataGrid를 가지고 있습니다. 처음으로로드 할 때 .xhrGet 및 json 데이터를 통해 데이터가 올바르게 표시됩니다. 검색 또는 새로 고침 버튼을 사용하면 올바른 데이터 저장소가 있음에도 불구하고 오류 메시지가 나타납니다. 이것은 내가 현재 도조 1.6과 데이터 그리드와 대화 상자의 내용을 사용하고Dojo DataGrid가 대화 상자의 데이터를 업데이트하지 않습니다.
dataGrid = dijit.byId("importPayeeGrid");
//dojo.destroy(dataGrid);
// Using dojo.xhrGet, as very little information is being sent
dojo.xhrGet({
url: -----,
handleAs: "json",
// The success callback with result from server
load: function(data) {
var store = new dojo.data.ItemFileReadStore({ data: data });
dataGrid.setStore(store); //the problem here
dataGrid.startup();
dijit.byId('MyDialog').hide();
},
대신 별도의 페이지에
편집 그것을 연결의 자바 스크립트 내부에 만들어 내 코드입니다 : 내가 할 수있는 전체 코드를 게시했지만 잘 ... 1k 라인의 자바 스크립트 코드. 버튼이
var dialog = dijit.byId("myDialog");
if (dialog == null) {
dialog = new dijit.Dialog({
id: "myDialog",
title: "Processing your request please wait ...",
bgColor: "gray",
bgOpacity: "0.5",
toggle: "fade",
toggleDuration: "250",
dragable: false
});
}
dialog.attr("title", "Payee Catalogue");
dialog.attr("content", "<div style=\"width: 800px; height: 100%;\">" +
"<table style=\"width: 100%;\"> <tr><td>"+
"<div>"+
"<div dojoType=\"dijit.form.DropDownButton\">"+
"<span>Filter Results</span>"+
"<div dojoType=\"dijit.TooltipDialog\"> "+
"<table class=\"myTable center\"> "+
"<tr> "+
" <td>Search:</td>"+
" <td><input type=\"text\" id=\"search_for\""+
" dojoType=\"dijit.form.TextBox\" value=\"\" id=\"search_for\" /></td>"+
"</tr>"+
"<tr>"+
" <td>In:</td>"+
" <td><select id=\"search_in\" dojoType=\"dijit.form.ComboBox\""+
" name=\"search_in\">"+
" <option>Pay to the Order Of</option>"+
" <option>Operating As</option>"+
" <option>Address</option>"+
" <option>Province</option>"+
" </select>"+
" </td>"+
"</tr>"+
"<tr>"+
" <td colspan=\"2\" align=\"right\">"+
" <button dojoType=\"dijit.form.Button\" type=\"button\""+
" onClick=\"queryImportButtons()\">Search</button>"+
" </td>"+
"</tr>"+
"</table>"+
"</div>"+
"</div>"+
"<div dojoType=\"dijit.form.Button\" id=\"refresh\" value=\"ref\""+
" onclick=\"refreshImport()\" title=\"Refresh\">"+
" <img src=\"../images/icons/database_refresh.png\" /> Refresh"+
"</div>"+
" <div dojoType=\"dijit.form.Button\" id=\"LikeF\" class=\"redButton\""+
" iconClass=\"customIcon close\""+
" style=\"disaplay: none; visibility: hidden; float: right;\">LIKE</div>"+
"</div>"+
"</td>"+
"</tr>"+
"</table>"+
"<div id=\"importPayeeGridContainer\" style=\"overflow: scroll;\" ></div><br/>" +
"<div style=\"float: right;\" dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('myDialog').hide();\">Cancel</div>" +
"<div style=\"float: right;\" dojoType=\"dijit.form.Button\" onclick=\"resizeGrid('importPayeeGrid', this);\">Resize</div>" +
"<div style=\"clear:both;\"> </div></div>");
importPayeeGrid(data);
을 클릭하고 페이지를 새로 고침하는 것은 내가
- 설정을 시도
이 코드
function queryData(query) { var dialog = dijit.byId("MyDialog"); if (dialog == null) { dialog = new dijit.Dialog({ id: "MyDialog", title: "Retrieving results please wait ...", bgColor: "gray", bgOpacity: "0.5", toggle: "fade", toggleDuration: "250", dragable: false }); } dialog.attr("title", "Retrieving results please wait..."); dialog.attr("content", "<img style=\"display: block; margin-left: auto; margin-right: auto;\" src=\"../images/ajax-loader.gif\"/>"); dialog._onKey = function(){ alert("Query can not be canceled."); /* * do * nothing */ }; dialog.show(); // store the query to be used in the refresh() function refreshQuery = query; dataGrid = dijit.byId("importPayeeGrid"); // Using dojo.xhrGet, as very little information is being sent dojo.xhrGet({ // TODO: this is where the problem occurs // The URL of the request url: "payee_profile_import_get.php" + TOKEN_STRING + query, handleAs: "json", // The success callback with result from server load: function(data) { // set grid data var store = new SimpleSaveWriteStore({ data: data }); dataGrid.store.close(); dataGrid.setStore(store); //dataGrid.startup(); dialog.hide(); }, // The error handler error: function() { dialog.attr("title", "Display Results"); // set grid error dialog.attr("content", "Failed to retrieve results." + "<div style=\"float: right;\" dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('MyDialog').hide();\">OK</div>"); } });
}에있을 때 그래서 처음 나는 대화 상자를 만들 업데이트 전에 데이터 그리드 저장소를 닫습니다.
- commentsi dataGrid.refresh를 (사용 dataGrid.startup()
- )
을 겨하지만 내가 가진 전부는 MSG "죄송합니다, 오류가 발생"이었다. 나는 xhrGet을 직접적인 것보다 사용하는 이유는 데이터 가져 오기가 실패 할 때 오류 메시지를 보여주기를 원하기 때문입니다. 이것은 제 1 기 게시물에 안 맞았습니다.
첫째, 왜 당신이 ItemFileReadStore
의 url
속성을 사용하지 마십시오
내 고용주가이 기능을 원하기 때문에이 문제를 다시 해결하기로 결정했기 때문에 내 질문을 오래 편집했습니다. –