我的Select2 3.4.5不能使用JSON数据.
这是HTML上的输入框:
<input class='form-control col-lg-5 itemSearch' type='text' placeholder='select item' />
Run Code Online (Sandbox Code Playgroud)
......和我的JavaScript
$(".itemSearch").select2({
placeholder: "Search for an Item",
minimumInputLength: 2,
ajax: {
url: "/api/productSearch",
dataType: 'json',
quietMillis: 100,
data: function (term, page) {
return {
option: term
};
},
results: function (data, page) {
var more = (page * 10) < data.total;
return {
results: data.itemName,
more: more
};
}
},
formatResult: function (data, term) {
return data;
},
formatSelection: function (data) {
return data;
},
dropdownCssClass: "bigdrop",
escapeMarkup: …Run Code Online (Sandbox Code Playgroud) 如何使用select2在输入框上设置默认值?这是我的HTML
<input type="text" id="itemId0" value="Item no. 1">
Run Code Online (Sandbox Code Playgroud)
和我的javascript:
$("#itemId0").select2({
placeholder: 'Select a product',
formatResult: productFormatResult,
formatSelection: productFormatSelection,
dropdownClass: 'bigdrop',
escapeMarkup: function(m) { return m; },
minimumInputLength:1,
ajax: {
url: '/api/productSearch',
dataType: 'json',
data: function(term, page) {
return {
q: term
};
},
results: function(data, page) {
return {results:data};
}
}
});
function productFormatResult(product) {
var html = "<table><tr>";
html += "<td>";
html += product.itemName ;
html += "</td></tr></table>";
return html;
}
function productFormatSelection(product) {
var selected = "<input type='hidden' name='itemId' …Run Code Online (Sandbox Code Playgroud) 美好的一天,我如何通过jquery或javascript正确关闭select2下拉列表?
现在我select2-dropdown.toggle()用来关闭它,
但我注意到它只会隐藏列表,而select2框仍然会突出显示 
我想失去焦点或类似的东西只是为了正确地关闭它并能够得出像这样的结果
.
顺便说一下屏幕截图很暗,因为那些select2框在一个bootstrap模式下,只要我按下回车就会出现.
任何建议真的很感激!提前致谢
美好的一天,
我是第一次使用jsPDF,我发现它很好的pdf生成器,因为它很快,并没有消耗服务器的CPU,但我很难添加一些样式,即使简单的文本alingment不起作用?任何人都可以帮助我这个,或给我一些操纵它的技巧?任何评论/答案/建议真的很感激.
这是我的代码.
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title></title>
{{ HTML::script("js/jspdf/js/jquery/jquery-1.7.1.min.js")}}
{{ HTML::script("js/jspdf/js/jquery/jquery-ui-1.8.17.custom.min.js")}}
{{ HTML::script("js/jspdf/js/libs/polyfill.js")}}
{{ HTML::script("js/jspdf/jspdf.js")}}
{{ HTML::script("js/jspdf/js/libs/deflate.js")}}
{{ HTML::script("js/jspdf/js/libs/adler32cs.js/adler32cs.js")}}
{{ HTML::script("js/jspdf/js/libs/FileSaver.js/FileSaver.js")}}
{{ HTML::script("js/jspdf/js/libs/Blob.js/Blob.js")}}
{{ HTML::script("js/jspdf/jspdf.plugin.standard_fonts_metrics.js")}}
{{ HTML::script("js/jspdf/jspdf.plugin.split_text_to_size.js")}}
{{ HTML::script("js/jspdf/jspdf.plugin.addimage.js")}}
{{ HTML::script("js/jspdf/jspdf.plugin.cell.js")}}
{{ HTML::script("js/jspdf/jspdf.plugin.from_html.js")}}
{{ HTML::script("js/jspdf/js/basic-test.js")}}
</head>
<body>
<div style="border-width: 2px; border-style: dotted; padding: 1em; font-size:120%;line-height: 1.5em;" id="fromHTMLtestdiv">
<div>
<h1>INVOICE No. 1</h1>
<p style="float:left">Doe, John A</p>
<p style="float:right">Oklahoma city</p>
</div>
<table>
<colgroup>
<col width="10%">
<col width="30%">
<col width="40%">
<col width="10%">
<col width="10%">
</colgroup>
<thead>
<tr>
<th>id</th>
<th>item …Run Code Online (Sandbox Code Playgroud) 为什么我不能抓住这个<a>......
<a href="javascript:void(0)" class="select2-choice select2-default" tabindex="-1">
<span class="select2-chosen">select item</span>
<abbr class="select2-search-choice-close"></abbr>
<span class="select2-arrow">
<b></b>
</span>
</a>
Run Code Online (Sandbox Code Playgroud)
...用这个jQuery?
$(document).ready(function() {
$( ".select2-choice" ).click(function() {
alert( "Handler for .keydown() called." );
});
});
Run Code Online (Sandbox Code Playgroud)
我认为这是产生下拉列表的功能:
createContainer: function () {
var container = $(document.createElement("div")).attr({
"class": "select2-container"
}).html([
"<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>",
" <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>",
" <span class='select2-arrow'><b></b></span>",
"</a>",
"<input class='select2-focusser select2-offscreen' type='text'/>",
"<div class='select2-drop select2-display-none'>",
" <div class='select2-search'>",
" <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>",
" </div>",
" …Run Code Online (Sandbox Code Playgroud) 我刚刚下载了一个现成的项目,它上面也有scss文件.当我尝试使用koala-app编译main.scss文件时,它给了我这个错误.
C:\ Users\1\Desktop\agency\sass\main.scss语法错误:要导入的文件未找到或不可读:compass/css3.
Run Code Online (Sandbox Code Playgroud)Load paths: C:/Program Files (x86)/Koala (DEPRECATED) C:/Users/1/Desktop/agency/sass on line 2 of C:\Users\1\Desktop\agency\sass\partials\_base.scss from line 4 of C:\Users\1\Desktop\agency\sass\main.scss Use --trace for backtrace.
顺便说一下第4行:@import"compass/css3";
我已经安装了:
ruby 1.9.3p545
gem 1.8.28
Run Code Online (Sandbox Code Playgroud)
main.scss
// MAIN
// all modules, general styles and variables
@import "partials/base";
@import "partials/general";
// third-party
@import "vendors/supersized";
@import "vendors/font-awesome.min";
@import "vendors/brankic-icon";
@import "vendors/flexslider";
@import "vendors/animate";
@import "vendors/jpreloader";
@import "vendors/magnific-popup";
// web elements/components
@import "partials/hero-unit";
@import "partials/about";
@import "partials/services";
@import "partials/works";
@import "partials/call-to-action";
@import "partials/team";
@import "partials/testimonial";
@import …Run Code Online (Sandbox Code Playgroud) 美好的一天,
如何在自定义html元素的sublime文本3上设置自动完成,例如,如果我键入:dog然后按Tab它将成为<dog></dog>..感谢您的答案.
美好的一天,
当我试图为我的数据库播种时,我遇到了错误"类DateTime的对象无法转换为字符串".
这是我的迁移代码:
public function up()
{
Schema::create('tblinventory', function(Blueprint $table) {
$table->increments('id');
$table->integer('itemId');
$table->enum('status', array('active','inactive'))->default(null)->nullable();
$table->float('purchasePrice');
$table->float('sellingPrice');
$table->date('expirationDate');
$table->float('ReceivedQuantity');
$table->float('soldQuantity');
$table->timestamps();
});
}
Run Code Online (Sandbox Code Playgroud)
和我的播种者:
<?php
class InventoryTableSeeder extends Seeder {
public function run()
{
// Uncomment the below to wipe the table clean before populating
DB::table('tblinventory')->truncate();
$insert = [
[
'itemId' => '1',
'status' => 'inactive',
'ReceivedQuantity'=>'100',
'SoldQuantity'=>'93',
'sellingPrice'=>'4.5',
'purchasePrice'=>'3.5',
'created_at' => new DateTime,
'expirationDate'=>date('2015-02-22')
],
[
'itemId' => '1',
'status' => 'inactive',
'ReceivedQuantity'=>'300',
'SoldQuantity'=>'300',
'sellingPrice'=>'4.75',
'purchasePrice'=>'3.65',
'expirationDate'=>date('2015-02-22')
],
[ …Run Code Online (Sandbox Code Playgroud) 美好的一天!
我使用“选择”插件进行下拉选择。我如何基于屏幕高度设置下拉菜单内容的高度,因为下拉菜单中有很多项目,将它们显示在比短列表更长的列表中会很好。
期望的输出
我尝试使用下面的代码,只是从在控制台上播放而已,但是它也不起作用。
.selectize-dropdown, .selectize-dropdown.form-control{
height: -webkit-fill-available !important;
height: -moz-available !important;
height: fill-available !important;
}
.selectize-dropdown-content{
/* height: -webkit-fill-available !important;
height: -moz-available !important;
height: fill-available !important;*/
}
Run Code Online (Sandbox Code Playgroud)
任何建议,谢谢!
美好的一天,
谁能帮助我如何在Laravel 4中使用TCPDF,我的意思是从通过composer update安装到从视图或通过控制器生成pdf.我曾试图在Google上搜索,但我找不到关于如何在Laravel 4上使用它的全面教程.抱歉这个noobish问题:).
谢谢您的帮助.我真的很感激.祝你有美好的一天!
javascript ×6
html ×5
jquery ×5
laravel ×3
css ×2
laravel-4 ×2
compass-sass ×1
json ×1
jspdf ×1
php ×1
sass ×1
selectize.js ×1
sublimetext ×1
sublimetext3 ×1
tcpdf ×1