Forum


11:16

15/03/2010

Hi guys,
i'm new to jqgrid. i just build my firs grid incl. a subgrid. the parent grid is a grid with countries, the subgrid is a grid with cities. for the country i have set the latitude/longitude value. for some cities i don't have this information.
in the grid i want to show the latitude/longitude for the cities. but when this value is empty i want to show the latitude/longitude from the parent (country).
how to do this?
thank you in advance!
the data is saved in a database. two tables (country [id, name, lat, lon], city [id, countryId, name, lat, lon])
16:29

10/08/2009

It's depend on how you implemanted your master/detail example. The natural way could be place in the country grid onSelectRow event. In the event handle you could change some parameters of details grid (city grid) like title, url with respect of setCaption, setGridParam or some other methods. Then you call trigger(“reloadGrid”) on details grid. You can also use getRowData inside of event handle to get all information from selected master row.
All logic about reading latitude/longitude from the parent (country) can do your server.
If you don't have any server part of your program, you could do all works in javascript also.
I recommend look at http://trirand.com/blog/jqgrid.....qgrid.html choose Advanced and "Master Detail".
Best rebards
Oleg
18:57

10/08/2009

Ohhh. This question is really not for the jqGrid forum! But you can fill city-table based on SQL statement like
SELECT
name,
CASE WHEN city.lat IS NULL
THEN country.lat
ELSE city.lat
END,
CASE WHEN city.lon IS NULL
THEN country.lon
ELSE city.lon
END,
FROM city
INNER JOIN country ON city.countryId=country.id
Regards
Oleg
Most Users Ever Online: 715
Currently Online:
65 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66