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
Updating Select Options for subgrid with local array data
01/03/2010
23:55
Avatar
jmr239
Member
Members
Forum Posts: 7
Member Since:
02/03/2010
sp_UserOfflineSmall Offline

Does anyone know how to trigger an event when the value of a select box changes in a subgrid with inline editting?  I need something equivalent to onChange, but that doesnt seem to work with jqgrid selects.  The reason i ask is i need to change the options for another select box based on the new value in the first box.  Any help would be greatly appreciated.. Thanks

03/03/2010
17:45
Avatar
jmr239
Member
Members
Forum Posts: 7
Member Since:
02/03/2010
sp_UserOfflineSmall Offline

Anyone?  From my googleing, this seems like a pretty common issue.  However, it would be a very nice feature for me to have for my site.

05/03/2010
13:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Please refer Here:

http://www.trirand.com/blog/?p.....38;ret=all

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

05/03/2010
16:08
Avatar
jmr239
Member
Members
Forum Posts: 7
Member Since:
02/03/2010
sp_UserOfflineSmall Offline

Tony,

I know you are probably sick of hearing about this issue, but could you please take a look at my post in the link you referred us to?  I really would like to know if what i'm trying to do can be done with jqgrid the way i am using it before i move to another approach.

Thanks,

Jeff

09/03/2010
19:13
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

IMHO, this should work.

Publishing the rest of code maybe will clarify the problem

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/03/2010
21:20
Avatar
jmr239
Member
Members
Forum Posts: 7
Member Since:
02/03/2010
sp_UserOfflineSmall Offline

Thanks for taking a look.

Here is the complete grid declaration:

jQuery("#timelinetable").jqGrid({
            datatype: "local",
            height: 500,
            colNames:['Grid','ReOrder','Override ID', 'Notes', 'Variable affected', 'Operation to Perform', 'Value for Operation', 'Type of Value Used'],
            colModel:[
                {name:'id',index:'id', width:55},
                {name:'reorder', index:'reorder', width:70, sorttype:"int",editable:true},
                {name:'cutid',index:'cutid', width:100, sorttype:"int", editable: false},
                {name:'notes', index:'notes', width:200, editable:true},
                {name:'var',index:'var', width:180, editable: true, edittype:"select", editoptions:{value:"evicttime:evicttime;bktime:bktime;collectime:collecttime;redemptime:redemptime;reotime:reotime;fctime:fctime;tottime:tottime;taxfactor:taxfactor;fhalimit:fhalimit;fcsaleflag:fcsaleflag;fcstartflag:fcstartflag"}},
                {name:'oper',index:'oper', width:180, editable: true, edittype:"select", editoptions:{value:"set:set;multiply:multiply;divide:divide;add:add;subtract:subtract"}},
                {name:'val',index:'val', width:180, editable: true},
                {name:'typeval',index:'typeval', width:180, editable: true, edittype:"select", editoptions:{value:"double:double;string:string;var:var"}}
            ],
            onSelectRow: function(id){
                if(id && id!=lastsel){
                    if(lastsel!=0){
                        jQuery("#timelinetable").saveRow(lastsel, false, 'clientArray');
                        jQuery("#timelinetable").restoreRow(lastsel);
                        timeoverrides[lastsel]=jQuery("#timelinetable").getRowData(lastsel);
                    }
                    jQuery("#timelinetable").editRow(id, true);
                    lastsel=id;
                }
            },
            subGrid: true,
            imgpath: 'jqgrid/themes/basic/images',
            caption: "Timeline Override Configuration",
            subGridRowExpanded: function(subgrid_id, row_id) {  
                var subgrid_table_id;
                subgrid_table_id = subgrid_id+"_t";
                $("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>");
                jQuery("#"+subgrid_table_id).jqGrid({
                    datatype: "local",
                    colNames: ['ID', 'Condition Variable','Condition','Value for Condition','Type of Value Used'],
                    colModel: [
                        {name:'id',index:'id', width:55},
                        {name:"condvar",index:"condvar",width:150, editable: true, edittype:"select", editoptions:{value:"bkflag:bkflag;bkchapter:bkchapter;proptype:proptype", dataEvents :[{type:'change', fn:function(e){
                                                                                                                    alert("yo");
                                                                                                                    var thisval = $(e.target).val();
                                                                                                                    alert(thisval);
                                                                                                                    lookupField(thisval, subgrid_table_id, row_id);
                                                                                                                    }}]}
                        },
                        {name:"condition",index:"condition",width:150, editable: true, edittype:"select",editoptions:{value:"equal:equal;notequal:notequal;greater:greater;greaterequal:greaterequal;less:less;lessequal:lessequal"}},
                        {name:"condval",index:"condval",width:150, editable: true}, //edittype:"select", editoptions:{value:"true:true;false:false"}},
                        {name:"condtypeval",index:"condtypeval",width:150,editable:true, edittype:"select", editoptions:{value:"double:double;string:string;var:var"}}
                        ],
                    onSelectRow: function(id){
                        if(id && (id!=lastsel2 || row_id!=lastsel2row)){
                            if(lastsel2!=0 && lastsel2row!=0){
                                var tempgrid = "#timelinetable_"+lastsel2row+"_t";
                                jQuery(tempgrid).saveRow(lastsel2, false, 'clientArray');
                                jQuery(tempgrid).restoreRow(lastsel2);
                                timeconditions[lastsel2row][lastsel2]=jQuery(tempgrid).getRowData(lastsel2);
                            }
                        
                            jQuery("#"+subgrid_table_id).editRow(id, true);
                            lastsel2=id;
                            lastsel2row=row_id;
                        }
                        
                    },
                    loadui:"disable",
                    height: 100,
                    imgpath: 'jqgrid/themes/basic/images',
                    caption: "Conditions for Override "+timeoverrides[row_id].cutid+" "
                });
                
                insertTimeConditionData(row_id, subgrid_table_id);
            },
            subGridRowColapsed: function(subgrid_id, row_id){
                var subgrid_table_id = subgrid_id+"_t";
                for(var i = 0; i<timeconditions[row_id].length; i++){
                    jQuery("#"+subgrid_table_id).saveRow(i, false, 'clientArray');
                    jQuery("#"+subgrid_table_id).restoreRow(i);
                    timeconditions[row_id][i]=jQuery("#"+subgrid_table_id).getRowData(i);
                }
                lastsel2=0;
                lastsel2row=0;
            },
            loadui:"disable"
            
        });

Everything else works great, i just can't get the dataEvent in the subgrid to fire.

Thanks again,

Jeff

11/03/2010
22:33
Avatar
jmr239
Member
Members
Forum Posts: 7
Member Since:
02/03/2010
sp_UserOfflineSmall Offline

any ideas?

15/03/2010
21:14
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Just simple question. Which version of jqGrid is used? I see imgpath options, which point me that 3.4 or less is used. Is this right?

The dataEvents is used from 3.5 version.

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.

15/03/2010
21:51
Avatar
jmr239
Member
Members
Forum Posts: 7
Member Since:
02/03/2010
sp_UserOfflineSmall Offline

Thank you thank you thank you. 

I was using 3.4.4... i updated and everything works great..

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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