Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
onempty set values from childs to parent
15/03/2010
11:16
Avatar
bas_vdl
Member
Members
Forum Posts: 7
Member Since:
15/03/2010
sp_UserOfflineSmall Offline

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])

15/03/2010
16:29
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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

15/03/2010
16:32
Avatar
bas_vdl
Member
Members
Forum Posts: 7
Member Since:
15/03/2010
sp_UserOfflineSmall Offline

i can do the logic on the server... any idea how to easily join and get the right results if city doesn't have a lat/lon value?

15/03/2010
18:57
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information