Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8175975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:58:37+00:00 2026-06-06T22:58:37+00:00

I have a jqgrid with the add dialog enabled for adding new rows. The

  • 0

I have a jqgrid with the add dialog enabled for adding new rows. The way I would like it to work is that the user will select from a list of drop down items and the item chosen will cause a second drop-down to be populated with data based on the first item.

For example, if my grid had two columns, one for country and one for state, when the user clicked the add button, the country input would be a drop-down, dynamically populated with countries by an ajax call. Then, when the user selects a country, the state drop-down is populated based on the country selected.

Currently I am doing something like the following:

            beforeProcessing: function () {
                var allcountries = ajaxcall();
                $('#clientReportsGrid').setColProp('Countries', { editoptions: { value: allcountries, class: 'edit-select' }, editrules: { required: true, edithidden: true} });
            },
            loadComplete: function () {
                $('#Countries').change(function () {
                    // States will be populated here
                    alert("changed");
                });
            }

The first part in beforeProcessing works fine and the countries drop-down is populated as expected. However, the event in loadComplete does not get attached to the select input with id the ‘Countries’ and the alert never occurs. It seems that the select object has not yet been created with loadComplete fires, but if that is the case I’m not sure where to place the logic where the states will be populated.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:58:39+00:00Added an answer on June 6, 2026 at 10:58 pm

    I ended up doing something like the following, its a bit redundant but it works and isn’t too code heavy:

    First, in the beforeProcessing callback, I populate both the countries and states drop-downs with their initial values:

    beforeProcessing: function () {
                var allcountries = ajaxCallToFetchCounties();
                $('#clientReportsGrid').setColProp('Countries', { editoptions: { value: allcountries, class: 'edit-select' }, editrules: { required: true, edithidden: true} });
                var states = ajaxCallToFetchStates();
                $('#clientReportsGrid').setColProp('States', { editoptions: { value: states , class: 'edit-select' }, editrules: { required: true, edithidden: true} });
            }
    

    Then in the pager’s add option, I used the beforeShowForm callback to attach a method to the change event of the countries select input, and within that method I fetch the states based on the current country and repopulate the select control:

    beforeShowForm: function (form) {
                    $("#Countries").unbind("change").bind("change", function () {
                        var states = ajaxCallToFetchStates();
                        //Manually clear and re-populate the states select box here with the new list of states.
                    });
                    $('#tr_AccountCode', form).show();
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jqGrid in my project and I would like to add custom
I currently have a a pretty standard jqgrid that I would like to change
I have a jqGrid that has add/edit dialogs with a form that's longer than
I have a JQGrid that's already been initialized. How can I add an event
I have jqGrid with enabled EDIT, DELETE, ADD and VIEW , Now my problem
So I have created a context box upon right click that has Add/Edit/Delete Rows.
I have a simple custom user control that uses jqGrid. the control is as
I have a jqgrid and I would add in the navgrid a personal function
I'm using the JQGrid and have an Add new button defined. $(gridId).jqGrid('navButtonAdd', pagerId, {
I'm using jqGrid with inlineNav so that users can edit/add/delete rows locally and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.