为什么我只使用jquery获取数组中的最后一行gridview值 [英] Why I am getting only last row of gridview values in array using jquery

查看:93
本文介绍了为什么我只使用jquery获取数组中的最后一行gridview值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var bookingitems = new Array();

var bookingitem = {};

$([id * = gvBookingDt] tr)。each(function( ){

bookingitem.ItemNo = $(this).find(span [class * = ItemNo])。html();

bookingitem.ItemDes = $(这个).find(td:nth-​​child(4))。html();

bookingitem.NoofPieces = $(this).find(td:nth-​​child(5) ).html();

bookingitem.Weight = $(this).find(td:nth-​​child(6))。html();

bookingitems .push(bookingitem);

});





我的Gridview包含两条记录:



itemNo Itemdesc noofpcs weight

1手机12 20kg

2笔记本电脑13 50 kg <当我试图找到数组详细信息时,




for(int i = 0; i< = bookingitems.Count-1; i ++){ }

获取olny最后一行值两次



我尝试过:



我试图在里面发出警报(gridvie循环w使用jquery)。在警告框中,它显示两行数据,但为什么它无法在arraylist中推送这两个项目。我不知道。



任何帮助。请......



提前致谢

var bookingitems = new Array();
var bookingitem = {};
$("[id*=gvBookingDt] tr").each(function () {
bookingitem.ItemNo = $(this).find("span[class*=ItemNo]").html();
bookingitem.ItemDes = $(this).find("td:nth-child(4)").html();
bookingitem.NoofPieces = $(this).find("td:nth-child(5)").html();
bookingitem.Weight = $(this).find("td:nth-child(6)").html();
bookingitems.push(bookingitem);
});


My Gridview contains two records:

itemNo Itemdesc noofpcs weight
1 mobile 12 20kg
2 laptop 13 50 kg

when i am trying to find array details
for(int i=0;i<=bookingitems.Count-1;i++){}
Getting olny last row value two times

What I have tried:

I have tried to put an alert inside (loop of gridview using jquery).In alert box,it's showing both two rows data,but why it's not able to push both item in arraylist.I am not getting any idea.

Any help.please......

Thanks in advance

推荐答案

([ id * = gvBookingDt] tr)。each(function(){

bookingitem.ItemNo =
("[id*=gvBookingDt] tr").each(function () {
bookingitem.ItemNo =


(this).find(span [class * = ItemNo])。html();

bookingitem.ItemDes =
(this).find("span[class*=ItemNo]").html();
bookingitem.ItemDes =


(this).find(td:nth-​​child(4))。 html();

bookingitem.NoofPieces =
(this).find("td:nth-child(4)").html();
bookingitem.NoofPieces =


这篇关于为什么我只使用jquery获取数组中的最后一行gridview值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆