我正在尝试防止在选择时发生模糊:在自动完成中调用.(选择:在自动完成的建议框中单击项目时调用)但是,无意中,当我从建议框中选择项目时会调用模糊.我该如何解决这个问题?
这是我的代码基本排列的方式.
$("#input_field").autocomplete({
source: "source.php",
select: function( event, ui ) { alert("Item selected! Let's not trigger blur!"); }
}).blur(function(event) {
alert("Alert if the user clicked outside the input, pressed enter, or tab button.");
alert("But not from the item selection! :S");
});
Run Code Online (Sandbox Code Playgroud)
谢谢!
编辑:这是一个简短的背景.我试图允许用户搜索/选择项目或创建新项目,如果用户模糊输入.
Python newb在这里.我试图在我的测试用例中重复使用相同的浏览器.但是,我无法弄清楚如何传递全局变量来使其工作.
目前,我有一个看起来像这样的main.py#!C:/Python27/python.exe
import unittest
import unittest, time, re, HTMLTestRunner, cgi
import os, sys, inspect
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
global DRIVER
DRIVER = webdriver.Firefox()
# Make all subfolders available for importing
cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
# Import test cases
from setup.testcaseA import *
from setup.testcaseB import *
# serialize the testcases (grouping testcases)
suite = unittest.TestSuite() # setup new test …
Run Code Online (Sandbox Code Playgroud) 我有以下表格:
Customer(customer_id) - 1000 rows (1000 customers)
Invoice(invoice_id, customer_id) - 1000000 rows (1000 invoices per customer)
Charge(charge_id, invoice_id, charge_amount) - 20000000 rows (20 charges per invoice)
Run Code Online (Sandbox Code Playgroud)
现在,我正在尝试使用它的总收费金额生成客户的发票.结果表看起来像这样:
Customer_name | invoice_id | charge_total
test 1 $1000
test 2 $1200
test 3 $900
...
Run Code Online (Sandbox Code Playgroud)
我的问题是,对于这种情况,数据库设计的最佳实践是什么?我正在思考以下两个选项:
谢谢大家!