使用Select2通过远程调用动态填充texbox,我希望允许用户将该字段留空.
$("#e6").select2({
placeholder: "Search for a movie",
minimumInputLength: 1,
ajax: {
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
dataType: 'jsonp',
data: function (term, page) {
return {
q: term, // search term
page_limit: 10,
};
},
results: function (data, page) {
return {results: data.movies};
}
},
});
Run Code Online (Sandbox Code Playgroud)
Texbox使用Select2动态填充远程调用,如何设置预选值.这是代码
<input type="hidden" id="e6">
$("#e6").select2({
placeholder: "Search for a movie",
minimumInputLength: 1,
ajax: {
url: url,
dataType: 'jsonp',
data: function (term, page) {
return {
q: term, // search term
page_limit: 10, };
},
results: function (data, page) {
return {results: data};
}
}
});
Run Code Online (Sandbox Code Playgroud)
我试着预先选择值1049
$('#e6').select2('val', '1049');
但是这不会在文本框中设置值.
有任何想法吗?
如果在SQL Server中使用"insert into"创建临时表,则使用第一个插入来确定列是否接受空值.如果第一个插入具有空值,则该列可以为空,否则它将是不可为空的.
有没有办法使用"insert into"创建临时表来接受空值?
例
这没有任何问题
Select 'one' as a , null as b
into #temp
insert into #temp
Select 'two' as a , 500 as b
Run Code Online (Sandbox Code Playgroud)
但是这会抛出"无法将值NULL插入列'b'"
Select 'one' as a , 500 as b
into #temp
insert into #temp
Select 'two' as a , null as b
Run Code Online (Sandbox Code Playgroud)
我知道我可以做create Table或alter column声明,但我想这样做而不重写数百个现有的查询.