M
Mahir
Hi
This is my first mail..
My advanced Thanks for helping me....
I have a JSON data for Country, and its codes
{"header":[{"HeaderName": "CountryName","Size": "200px","hide": "0"},
{"HeaderName": "Code","Size": "110px","hide": "1"},{"HeaderName":
"UNCode","Size": "150px","hide": "0"}],"hiddenValueField":
"Code","values":[{"CountryName": "India","Code": "In","UNCode": "In"},
{"CountryName": "Singapore","Code": "Sg","UNCode": "Sg"},
{"CountryName": "Malaysia","Code": "Mal","UNCode": "Mal"},
{"CountryName": "United Kingdom","Code": "UK","UNCode": "UK"},
{"CountryName": "United States","Code": "US","UNCode": "US"}]}
I am creating a table using dom with the data above...
1. Now i want to hide particular Column using the header[0].hide, if
hide is 1 then the corresponding columns in rows at the "values"
should also hidden
2. I want to read all the "Name":"value" of "values" instead of
values[0].CountryName or values[0].Code (so that i can generalize the
code for other JSON Data)
say here in header[1] "Code" is hide=1 then in "values" columns "Code"
in all rows should be hidden
table1=document.createElement('table')
tbody1=document.createElement('tbody');
tr=document.createElement('tr');
//header part
for(i=0;i<Country.header.length;i++){
td=document.createElement('td');
//alert(Country.header.HeaderName)
td.innerHTML="<b>"+Country.header.HeaderName+"</b>"
td.style.width=Country.header.Size
if(Country.header.hide=="1"){
td.style.display='none'
}
tr.appendChild(td)
}
for(i=0;i<Country.values.length;i++){
tr=document.createElement('tr')
td=document.createElement('td');
td.innerHTML=Country.values.CountryName
//in this loop i have to do something to hide and display data
//all columns in the values have to be get in loop here instead of
writing td's for each "Name",value pairs
}
please help me.
THanks
Mahir
This is my first mail..
My advanced Thanks for helping me....
I have a JSON data for Country, and its codes
{"header":[{"HeaderName": "CountryName","Size": "200px","hide": "0"},
{"HeaderName": "Code","Size": "110px","hide": "1"},{"HeaderName":
"UNCode","Size": "150px","hide": "0"}],"hiddenValueField":
"Code","values":[{"CountryName": "India","Code": "In","UNCode": "In"},
{"CountryName": "Singapore","Code": "Sg","UNCode": "Sg"},
{"CountryName": "Malaysia","Code": "Mal","UNCode": "Mal"},
{"CountryName": "United Kingdom","Code": "UK","UNCode": "UK"},
{"CountryName": "United States","Code": "US","UNCode": "US"}]}
I am creating a table using dom with the data above...
1. Now i want to hide particular Column using the header[0].hide, if
hide is 1 then the corresponding columns in rows at the "values"
should also hidden
2. I want to read all the "Name":"value" of "values" instead of
values[0].CountryName or values[0].Code (so that i can generalize the
code for other JSON Data)
say here in header[1] "Code" is hide=1 then in "values" columns "Code"
in all rows should be hidden
table1=document.createElement('table')
tbody1=document.createElement('tbody');
tr=document.createElement('tr');
//header part
for(i=0;i<Country.header.length;i++){
td=document.createElement('td');
//alert(Country.header.HeaderName)
td.innerHTML="<b>"+Country.header.HeaderName+"</b>"
td.style.width=Country.header.Size
if(Country.header.hide=="1"){
td.style.display='none'
}
tr.appendChild(td)
}
for(i=0;i<Country.values.length;i++){
tr=document.createElement('tr')
td=document.createElement('td');
td.innerHTML=Country.values.CountryName
//in this loop i have to do something to hide and display data
//all columns in the values have to be get in loop here instead of
writing td's for each "Name",value pairs
}
please help me.
THanks
Mahir