Forum

July 12th, 2025
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
editoptions + select from local array
24/09/2009
20:15
Avatar
Romyn
Member
Members
Forum Posts: 45
Member Since:
13/06/2009
sp_UserOfflineSmall Offline

Hi,

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

24/09/2009
21:32
Avatar
MamaliFrenchi
Member
Members
Forum Posts: 62
Member Since:
22/12/2008
sp_UserOfflineSmall Offline

editoptions:{value:courselist} courselist shouldbe as the follow:

<select><option value="23">Course1</option><option value="45">Course2</option></select>

24/09/2009
23:33
Avatar
seantsm28
California
Member
Members
Forum Posts: 5
Member Since:
12/08/2009
sp_UserOfflineSmall Offline

What has worked for me has been using this pattern:

var coursevalues = "23:Course1;45:Course2";

(colons between key and value, semicolon separator between option pairs, quotes only at beginning and end of entire list)

24/09/2009
23:35
Avatar
seantsm28
California
Member
Members
Forum Posts: 5
Member Since:
12/08/2009
sp_UserOfflineSmall Offline

To fit your example I should have used courselist for the variable name.

var courselist = “23:Course1;45:Course2″;

25/09/2009
12:00
Avatar
Romyn
Member
Members
Forum Posts: 45
Member Since:
13/06/2009
sp_UserOfflineSmall Offline

Thanks.

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

Forum Timezone: Europe/Sofia

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

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information