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
Dropdown changes dynamically
03/10/2009
08:11
Avatar
varta
Member
Members
Forum Posts: 10
Member Since:
22/09/2009
sp_UserOfflineSmall Offline

Now I´m trying to make dynamic dropdown but I have a problem, it loads only once

here is the code:

    {name:'id384',index:'id384',
            sortable:true,
            editable:true,
            edittype:”select”,

            editoptions:{dataUrl:'Opc/HlpTabla.php?zTabla=st384',
                        dataEvents: [
                          {  type: 'change',
                             fn: function(e) {
                                alert($("#id384").val());
                                $("#id195").parent().load('Opc/HlpTabla.php?zTabla=st195&key=id384&val='+$("#id384").val());
                             }
                          }],}
        },
        {name:'id195',index:'id195',
            sortable:true,
            editable:true,
            edittype:”select”,
            editoptions:{value:{}}
        },

The HlpTabla.php return something live “<select><option></option>…</select>”

Fisrt time it loads ok and works but if I change the id384 contents it doesn´t update the id195 select

Thanks for help me.

Martin

PD: I create a new topic because could be easier to follow

04/10/2009
17:28
Avatar
MamaliFrenchi
Member
Members
Forum Posts: 62
Member Since:
22/12/2008
sp_UserOfflineSmall Offline

Does your alert($("#id384").val()); is showing each time you're changing your dropdown?

according to document :

dataEvents: list of events to apply to the data element; uses
$("#id").bind(type, [data], fn) to bind events to data element

Should be described like this dataEvents: [
{ type: 'click', data: { i: 7 }, fn: function(e) { console.log(e.data.i); }
}, { type: 'keypress', fn: function(e) { console.log('keypress'); } }
]

The event(s) are called only once when the element is created

if you know your jquery object (the dropdow id etc ) you might be using live event of jquery.
05/10/2009
14:41
Avatar
varta
Member
Members
Forum Posts: 10
Member Since:
22/09/2009
sp_UserOfflineSmall Offline

First, thanks for answer.

Sorry the alert was a flag I forgot.

So, I cannot do it form Jqgrid? Because I read the doc and I cannot find a solution.

Thanks

Martin

06/10/2009
06:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

You do not answer of the question - does your alert show the changed value?

or

Should I think the you speak about the select in dataUrl?

I do not understand what you try to do

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.

08/11/2009
08:15
Avatar
Joy
Guest
Guests

Hi man,

I have exactly the same problem, It loads the first time, but not the second.

The alert shows up every time i change the original select, but second select does not. It changes only on the first time.

Is this the only way to do a dynamic select? i'm trying to resolve the classic case of Zip-state-city.

any help?

09/11/2009
10:20
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Do you have check in FireBug if the request is posted?

Also you should use load with care. Try to use the pure $.ajax and see the result.

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.

09/11/2009
11:19
Avatar
Joy
Guest
Guests

Hi tony, I have changed, now I'm using $.ajax (I have tried also with a standard javascript ajax function) and all go right, but now I have another problem.

I used the called to the function on the beforeShowForm event, but doing so the select doesnt fire the right value.

If I just close and reopen the form all go right.

Thank you in advance.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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