Forum
Topic RSS
20:15
13/06/2009
OfflineHi,
Been struggling this for hours and after reading many threads connected with select and editoptions I know the answer is in here somewhere but unfortunately I'm having difficulty digging it out - so I'm hoping someone can put me out of my misery.
I have a grid (grid_rm) in which one of the columns (dbcourseid) contains the primary key from a database table. The column is set to edittype "select" and I want it to perform like a standard dropdown - see/select a text value but store an ID.
All my data is in local arrays so after I initialise the grid but before I load any data I put together the option list for this select - "courselist".
I then use the setColProp call to set this for the column:-
$("#grid_rm").setColProp('dbcourseid',{editoptions:{value:courselist}});
The problem is I can't seem to get the courselist to be in the right format to display as intended?
At the moment I have the data in an array - for example...
Course[0] ID=23 Text="Course1"
Course[1] ID= 45 Text="Course2"
etc (but can do it any way)
What I can't seem to do is to get it into the format {23:"Course1",45:"Course2} which I think is the correct way.
Any assistance to put me right would be greatly appreciated.
Thanks
Romyn
12:00
13/06/2009
OfflineThanks.
I've now managed to get the select's listing to work but have run into other problems now.
I initialise the relevant column in the grid with
{name:'dbcourseid', index:'dbcourseid', width:60, editable:true, edittype:'select', align:'left'}
I then work out what the courselist should be - in this case
19:Blue;20:Orange;21:Green
I then set this as the source for the column using
$("#grid_rm").setColProp('dbcourseid',{editoptions:{value:courselist}});
I then load 2 rows using addRowData
The dbcourseid column for these 2 rows show the numbers rather than the colours. I've tried with formatter:'select' but that doesn't seem to work either. (I'm running an earlier version of 3.5 so upgraded to 3.5.3 but that causes other errors in other grids which I can't pin down)
However if I add another row using editGridRow("new") then the dropdown in that shows the colours and also stores the colour, rather than the number, in the grid.
I can't work out what I have to do to make the column behave like a standard foreign key column - ie ID Value where the ID is stored but the Value is displayed. I suspect this may be fixed, from reading other threads, on the latest version but I can't get 3.5.3 to work without errors elsewhere and when I skip over the bits that it errors on (other grids) it still doesn't do it - with or without the formatter option set.
Am I doing something fundementally wrong here?
Thanks again.
Romyn
Most Users Ever Online: 994
Currently Online:
22 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
Log In
Home