这似乎是在jeditable loadtext物业等待服务器选择下拉列表中的项目时不工作 [英] It seems like loadtext property in jeditable doesn't work when waiting for select dropdown items from server
问题描述
我使用 jeditable,我从我的服务器加载选择下拉(这需要几秒钟就可以通过AJAX加载),我希望在Ajax调用运行让人们知道,在下拉列表正在从服务器加载显示加载图像或文字。
I am using jeditable and i am loading a select dropdown from my server (it takes a few seconds to load via ajax) and i want to display a loading image or text while the ajax call is running so people know that the dropdown list is being loaded from the server.
我看到的就有指示器财产保存价值的服务器(运行完美)时显示加载图像或文字,但由于某些原因,没有工作的选项设置,当你加载项的加载信息对于选择下拉列表。
I see there is the "indicator" property to show a loading image or text when saving the value to the server (which works perfect) but for some reason there is no working option to set a loading message when you are loading items for the select dropdown.
当我看着这个插件,我看到了一个loadtext属性,似乎应该这样做,但是当我点击我的文字我没有看到这个加载。当它揭开序幕AJAX查询来获取下拉列表中显示的文本。
When i look into the plugin, i see a "loadtext" property that seems like it should be doing this but when i click on my text i don't see this "Loading . ." text displayed when it kicks off the ajax query to get the list of dropdown.
下面是我的code:
$('#person').editable('/Project/UpdatePerson', {
loadurl: '/Project/GetPeople',
type: 'select',
loadtext: '<b>Loading Dropdown...<img src="/Content/Images/ajax-loader.gif" /></b>',
indicator: '<b>Saving...<img src="/Content/Images/ajax-loader.gif" /></b>',
submit: 'OK',
callback : function(value, settings) {
var json = $.parseJSON(value);
$(this).text(json.Value);
}
});
有什么建议?
推荐答案
试试这个,
$(document).ajaxStart(function() {
$('#person').append('<span>Loading..</span>')
});
$(document).ajaxStop(function() {
$('#person').find('span').remove()
});
更新:
更改阿贾克斯code到这jeditable插件,
Change the ajax code with this in jeditable plugin ,
$.ajax({
type : settings.loadtype,
url : settings.loadurl,
data : loaddata,
beforeSend: function(){
if(settings.type == 'select'){
$(self).append('<span>Loading...</span>')
}
},
//async : false,
success: function(result) {
window.clearTimeout(t);
content.apply(form, [result, settings, self]);
$(self).find('span').remove()
input_content = result;
input.disabled = false;
}
});
希望这是对你的作品。
Hope this is works for you.
这篇关于这似乎是在jeditable loadtext物业等待服务器选择下拉列表中的项目时不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!