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
editoptions dynamicly load from database
10/12/2008
11:31
Avatar
majkel
Member
Members
Forum Posts: 69
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

How to dynamicly load 'editoptions'(select field) with data from database within Column MOdel?

Greetings

Majkel

12/12/2008
04:50
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

One possible solution is to use userdata array and setColProp method combined with loadComplete event.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

12/12/2008
06:29
Avatar
majkel
Member
Members
Forum Posts: 69
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

Thanx

15/12/2008
06:49
Avatar
pequesalta
Member
Members
Forum Posts: 7
Member Since:
04/12/2008
sp_UserOfflineSmall Offline

Could you write an example?

This cuestions is the most asked in the forum.

Thanks for all.

08/02/2009
19:59
Avatar
majkel
Member
Members
Forum Posts: 69
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

I've added the following to jqgrid

jQuery("#grid_table").jqGrid({

....

userdata: 'userData',  
 loadComplete: function(){
  select_options2 = $('#grid_table').getGridParam("userData");
 // select_options2 = {"sklep":"1:real;2:lidl;3:auchan;4:media"};
  var op_sk = select_options2.sklep;
  alert(op_sk);
  gt2 = {'editoptions': {'value':op_sk}};
 
  $("#grid_table").setColProp('sklep',gt2);
   
 },
 ...

There is some error when I call getGridParam. Probably it doesn't get data from server properly although the JSON is sended and looks like this:

....

{"page":null,

"total":497,

"records":"497",

"rows":

  [{"id_produkt":"1","cell":["1","frytki","3.49","0","1","2008-11-02","lidl","spo?ywcza"]}],

"userData":

    {"sklep":"1:real;2:lidl;3:auchan;4:media"}

}

Any ideas what is wrong?

Majkel

08/02/2009
20:02
Avatar
majkel
Member
Members
Forum Posts: 69
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

PS.

We can test part of code and uncoment the following code

 // select_options2 = {”sklep”:”1:real;2:lidl;3:auchan;4:media”};

and it works.

11/02/2009
10:40
Avatar
majkel
Member
Members
Forum Posts: 69
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

It doesn't work so any ideas what is wrong? I  am stuck

Majkel

16/02/2009
08:57
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

What does not work? How look your data. Remember the last item should not end with ; - this will break the select. To make a test just put a string and see what is it -  I mean

loadComplete : function () {

$("#mygrid").setColProp('myname',editoptions:{'1:one;2:two'});

}

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

17/02/2009
07:43
Avatar
majkel
Member
Members
Forum Posts: 69
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

Data from serwer is presented in post at 19:59 08/02/2009 in this topic:

“userData”:

  {”sklep”:”1:real;2:lidl;3:auchan;4:media”}

JQGrid can't get userData from serwer.

select_options2 = $('#grid_table').getGridParam(”userData”);

if I replace above line(testing) with this:
  select_options2 = {”sklep”:”1:real;2:lidl;3:auchan;4:media”};

everything is ok, but select options are just static text.

If I alert(select_options2.sklep); in case of dynamic I get a message:

undefined

If I alert(select_options2.sklep); in case of static(test) I get a message:

1:real;2:lidl;3:auchan;4:media

So the dead point is marked red

I've try olso such a construction:

select_options2 = jQuery('#grid_table').getUserData();

24/02/2009
16:49
Avatar
majkel
Member
Members
Forum Posts: 69
Member Since:
10/11/2008
sp_UserOfflineSmall Offline

OK it works.I made something like this:

...

userdata: 'userdata',  
 loadComplete: function(){
  select_options = jQuery('#grid_table').getUserData();
  $("#grid_table").setColProp('sklep',{'editoptions': {'value':select_options.sklep}});
},

...

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
45 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