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
Grid Forms and Select Boxes
06/04/2009
08:01
Avatar
Nathan
Member
Members
Forum Posts: 37
Member Since:
20/03/2009
sp_UserOfflineSmall Offline

Hi,

On my form I have a few select boxes and I want to dynamically load the content. I've wrote handlers to do this and it works fine except for one problem.  When the form loads only one box will fire and I think it has to do with the onInitializeForm event - it only fires once.  If I want to assign a focus event to each control how do I add it?  Currently I am working with :

navGrid('#equipmentNav',{refresh:true,add:true,del:true,edit:false, search:false},{},    {height:280,reloadAfterSubmit:true,onInitializeForm:function(form_id){$("select#ACTIVITY",form_id).focus(function(){
            //alert("trying ajax connection...");
            fillCombo("./Actions/ActiveActivities.php","select#ACTIVITY");

        })},onInitializeForm:function(form_id){$("select#EQUIPMENT",form_id).focus(function(){
                        //alert("trying ajax connection...");
                        fillCombo("./Actions/ActiveEquipment.php","select#EQUIPMENT");   

                    })}},{reloadAfterSubmit:true});

as my navbar definition.  I think there must be a way to chain these events but I am unsure how...

Nathan

07/04/2009
07:53
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Use beforeShowForm - it is called every time you open the form.

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.

07/04/2009
10:54
Avatar
Nathan
Member
Members
Forum Posts: 37
Member Since:
20/03/2009
sp_UserOfflineSmall Offline

Hi Tony,

I'm trying to use the beforeShowForm event but I am still just having one box fire.

What I am looking to add is a focus event to each select box.  When the box receives focus an ajax getJSON request is completed.  This part is fine. The issue is that I have is attaching the event to the 3 select boxes so that only it's ajax call is completed. I think I have to chain the function calls somehow but I am unsure how and I can't find an example to illustrate this step.

I would prefer that each time the select box is clicked that the dropdown list is rebuilt rather than just once when the form is constructed - that's why I am trying to add the focus element to the beforeShowForm event.

Right now I am working with:

    .navGrid('#expensesNav',{refresh:true,add:true,del:true,edit:false, search:false},{},{height:280,reloadAfterSubmit:true,beforeShowForm:function(form_id){$("select#ACTIVITY",form_id).focus(function(){
        //alert("trying ajax connection...");
        fillCombo("./Actions/ActiveActivities.php","select#ACTIVITY");   
        //fillCombo("./Actions/ActiveExpenseTypes.php","select#EXPENSETYPE");
    })}function(form_id){$("select#EXPENSETYPE",form_id).focus(function(){
        fillCombo("./Actions/ActiveExpenseTypes.php","select#EXPENSETYPE");   
       
    })}    },{reloadAfterSubmit:true});

Any thoughts on how to chain/call my methods to add a focus command to the select boxes?

Nathan

14/04/2009
01:15
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Not sure what you mean with chining, but it is simple and you can do

beforeShowForm:function(form_id{  // BEGIN EVENT $(”select#ACTIVITY”,form_id).focus(function(){
        fillCombo(”./Actions/ActiveActivities.php”,”select#ACTIVITY”);

});

$(”select#EXPENSETYPE”,form_id).focus(function(){
   fillCombo(”./Actions/ActiveExpenseTypes.php”,”select#EXPENSETYPE”);   
});

} //END beforeShowForm EVENT

If you want this to happen only once use onInitializeForm with the same code.

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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