0
- 樣品: 1牛肉1炒飯1的特色牛肉2廚房3犬
- 結果: 牛肉,炒飯,特色牛肉廚房狗
假設QNO(1)是號和代碼(牛肉)等是名稱 如何顯示一個數字並獲取所有名稱並將其返回到一個div。我只用一個div來顯示所有的數據。提前致謝。我知道,這很容易讓u人,但林太長的代碼吧...如何選擇只有一個號碼,並得到所有有名字
**Here is the javascipt.**
success: function (data) {
$('#scrollIncoming').empty();
for (var i in data) {
var rc = '#' + (Math.random() * 0xFFFFFF << 0).toString(16);
var qno = [data[i].QueueNo];
for (var currentQueueNo = 0; currentQueueNo < qno.length; currentQueueNo++)
$('#scrollIncoming').append(
'<span style="background-color:' + rc + ';width: 33%;border:1px solid black;height: 220px;float: left;">' +
'<span style="font-size: 60px;color:white; text-align: center;margin-top:30px;margin-left: 150px">' + qno[currentQueueNo] + '</span>' +
'<span style="font-size: 10px;width: 33%;text-align: center;color:black;margin-top:80px;margin-left: 80px">' +
data[i].Quantity + ' ' + data[i].Code +
'<span style="font-size: 20px;width: 33%;text-align: center;margin-top:150px;margin-left: 50px">' +
'<img src="./resources/images/dispatch.png"/></a>' +
'<img src="./resources/images/dispatchingPage.png"/></a>' +
'<img src="./resources/images/undo.png"/></a>' + '</span>' +
'<div id="div1">' +
'</div>'
);
$('#lblIncomingCounter').text(data.length);
}
}
**Here is the aspx.**
<form id="form1" runat="server">
<div style="background-color: #ecf0f1; width: 100%; border: black 1px solid; margin: auto">
<div id="scrollIncoming">
<div id='container'>
</div>
</div>
</div>
</form>
**Here is the code behind**
listTransactions.Add(new ....() {
QueueNo = Convert.ToInt32(rdr["dd_queue_no"]),
RefNo = Convert.ToInt32(rdr["key"]),
Quantity =Convert.ToInt32(rdr["quantity"]),
Code = Convert.ToString(rdr["name"]),
OrderStatus = Convert.ToInt32(rdr[".."])
});
**Here is the sp**
@cluster int,
@order_status int
..
declare
@datetoday datetime
set @datetoday = CONVERT (date, GETDATE())
select
DISTINCT (t.dd_queue_no),
t.[key],
p.name,
pt.quantity,
t.dd_order_status
from
transactions t
inner join
product_transactions pt
on
t.[key] = pt.transactions_key
inner join
products p
ON
pt.[products_key] = p.[key]
where
t.dd_cluster_key = @cluster and t.dd_order_status = @order_status
and
t.[datetime]
between
cast(@datetoday+' 00:00:00' as datetime) and cast(@datetoday+' 23:59:00' as datetime)
order BY
[dd_queue_no]
如果你添加一個jsfiddle示例代碼,你可能會得到一個更好的結果。 – Seminda 2014-08-28 06:39:37
你的數據是否來自ASP.NET後端? – Seminda 2014-08-28 06:40:33
我沒有jsfiddle。是的後端 – John 2014-08-28 06:48:32