| |

VerySource

 Forgot password?
 Register
Search
View: 1718|Reply: 12

How is the value of DateSet in JavaScript always undefined ???

[Copy link]

1

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-28 09:00:02
| Show all posts |Read mode
var i = ds.table [0] .rows [0] ["city"]
alert (i)

Always warning undefined
Is there a syntax error? How can I write to get the value?
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-2-23 10:00:01
| Show all posts
Where is ds ????? Client and DataSet?
Reply

Use magic Report

0

Threads

46

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-2-23 11:45:02
| Show all posts
Client, ds is not an object, look at table
Reply

Use magic Report

1

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-2-23 13:45:01
| Show all posts
Ajax, yes
if (response.value! = null)
{document.all ("DropDownList2"). length = 0;
Var ds = response.value;
if (ds! = null&&typeof (ds) == "object"&&ds.Tables! = null)
{
for (var i = 0; i <ds.Tables [0] .Rows.length; i ++)
{
Var var name = ds.Tables [0] .Rows [i] ["city"];
Alert (name)
Document.all ("DropDownList2"). Options.add (new Option (name, id));
}
}
}

ds.Tables [0] .Rows.length can get the value!
Reply

Use magic Report

0

Threads

5

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-23 19:15:01
| Show all posts
Get table object using document.getElementById ("idname") in javascript
Because the datagrid is converted into a table on the client
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-2-23 20:45:02
| Show all posts
Ajax is unfamiliar and I don't know how the type of DS is defined on the client.

Can you check the case?
Or
ds.table [0] .rows [0] ["city"] Replace it with ds.table [0] .rows [0] [index] and see.
JavaScript generally doesn't seem to use string as the key value.
Reply

Use magic Report

1

Threads

7

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-2-23 22:30:01
| Show all posts
Not very clear, my DS is taken from the response, that is, var ds = response.value; and ds.Tables [0] .Rows.length can indeed get the number of rows of ds, then I want to get the corresponding field Value, how should the code be written?
Reply

Use magic Report

0

Threads

5

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-23 23:15:01
| Show all posts
var tableDate = document.getElementById ("tableid");
var cellDate = tableDate.rows [0] .cells [1];
Reply

Use magic Report

1

Threads

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-2-24 08:15:02
| Show all posts
Return a datatable object.
Then use var i = ds.rows [0] ["city"]
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-29 18:45:02
| Show all posts
I can't use response.write directly in the cs file.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list