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 6077949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:46:42+00:00 2026-05-23T10:46:42+00:00

I’ve got some code that, when switching which row is selected, it triggers a

  • 0

I’ve got some code that, when switching which row is selected, it triggers a save of the previously selected row.

The row is being successfully saved without any problem, however the successfunc isn’t being called at all – my console.log output never shows up, and the code in this function isn’t being run. I also tried specifying the function as the aftersavefunc, but couldn’t get that to work either.

Seems like a simple syntax problem, but I can’t quite get it right. Am I not specifying this function properly?

As a side note, I realize that reloading the entire grid after a row save seems like overkill, but in the context of where this particular piece of code is, within the larger structure of my app, this snippet of code is a special case.

The full jqGrid code is:

var lastSelectedMainGridRowID = 0;
var lastSelectedSubGridRowID = 0;
var translationsFeed = "/update/translations/ajax/translations_feed.php";
var translationsEdit = "/update/translations/ajax/translations_edit.php";
var translationsSubGridFeed = "ajax/translations_subgrid_feed.php";
var translationsSubGridFeedEdit = "ajax/translations_subgrid_feed_edit.php";

$(document).ready(function () {
$("#translationsList").jqGrid({
    caption : "Translations",
    datatype : "xml",
    url : translationsFeed,
    editurl : translationsEdit,
    mtype : "get",
    pager : "#translationsPager",
    rowNum : 20,
    autowidth : true,
    sortname : "phrase",
    sortorder : "asc",
    viewrecords : true,
    multiselect : false,
    hidegrid : false,
    height : 300,
    altRows : true,
    rownumbers : true,
    toolbar : [false],
    loadComplete: function(data) {
        jQuery("#translationsList").setSelection (0, true);
    },
    colNames : ["phrase_id", "translation_id", "language_cd", "Phrase", "Translation", "Modified", "Created", "Active"],
    colModel : [
            { name : "phrase_id",                                   index : "phrase_id",            sortable : true,    search : false, editable: true, edittype : "text",      editrules: { edithidden: true },                                    hidden: true},
            { name : "translation_id",                          index : "translation_id", sortable : false, search : false, editable: true, edittype : "text",      editrules: { edithidden: true },                                    hidden: true},
            { name : "language_cd",                                 index : "language_cd",      sortable : true,    search : true,  editable: true, edittype : "text",      editrules: { edithidden: true, required : true }, hidden: true },
        { name : "Phrase",              width:200,  index : "phrase",               sortable : true,    search : true,  editable: true, edittype : "text",      editrules: { required: true } },
        { name : "Translation",         width:200,  index : "translation",      sortable : true,    search : true,  editable: true, edittype : "text",      editrules: { required: false } },
        { name : "Modified",            width:100,  index : "modify_dt",            sortable : true,    search : true },
        { name : "Created",             width:100,  index : "create_dt",            sortable : true,    search : true },
        { name : "Active",              width:20,       index : "active",               sortable : true,    search : true,  editable: true, edittype: "checkbox", editoptions: {value:"Yes:No", checked: true} }
    ],
    onSelectRow: function(id) {
            jQuery('#translationsList').jqGrid('saveRow', lastSelectedMainGridRowID);
            jQuery('#translationsList').jqGrid('editRow', id, true);
            lastSelectedMainGridRowID = id;
    },
    subGrid: true,
    subGridRowExpanded: function(subgrid_id, row_id) {
        var subgrid_table_id;
        jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>");
        jQuery("#"+subgrid_table_id).jqGrid({
            url: translationsSubGridFeed + "?phrase_id=" + row_id,
            editurl: translationsSubGridFeedEdit,
            datatype: "xml",
            colNames: ['phrase_id', 'translation_id', 'language_cd', 'Translations', 'Language', 'Active'],
            colModel: [
                            {name:"phrase_id",          index:"phrase_id",          sortable: false,    editable: true,     edittype : "text", editrules: { edithidden :true },                             hidden: true},
                            {name:"translation_id", index:"translation_id", sortable: false,    editable: true,     edittype : "text", editrules: { edithidden :true },                             hidden: true},
                            {name:"language_cd",        index:"language_cd",        sortable: false,    editable: true,     edittype : "text", editrules: { edithidden :true },                             hidden: true},                          
                    {name:"Translation",        index:"translation",        sortable: true,     editable: true,     edittype:"text",                                                                                                    width:589},
                {name:"Language",               index:"language_disp",  sortable: true,     editable: false,                                                                                                                                        width:250},
                {name:"Active",                 index:"active",                 sortable: true,     editable: true,     edittype:"checkbox", editoptions:{value:"Yes:No", checked: true}, width:80}
            ],
            height: "100%",
            rowNum:20,
            sortname: 'language_cd',
            sortorder: "asc",
            onSelectRow: function(id) {
                jQuery("#"+subgrid_table_id).jqGrid('saveRow', lastSelectedSubGridRowID, function(response) {
                  console.log("Data: " + response.responseText);
                  return false;
                });
                jQuery("#"+subgrid_table_id).jqGrid('editRow', id, true);
                lastSelectedSubGridRowID = id;
            }
        });
    }

});

Perhaps I don’t need to use saveRow. In this case, what I’m doing is:

  1. When you click on a row, it becomes editable
  2. If you then click on a second row, the first row is saved (and no longer selected), and the new second row then becomes editable. Similar to saving a row “onBlur”, so to speak.
  • 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-05-23T10:46:43+00:00Added an answer on May 23, 2026 at 10:46 am

    I don’t see the place of code where responseData variable are defined. The code responseData[0] should throw an exception, so the console.log("Data: " + responseData[0]); will not display any data. The line of code should be probably fixed as

    console.log("Server response: " + result.responseText);
    

    UPDATED: Without having the data for the both grid and for example the subgrid corresponds the first row one can’t debug the code. Reading is not so effective. If you posted the test data (two XML files) I could try to localize the problem.

    An important error is that you only declare subgrid_table_id variable, but not assign a value for it. Typically one construct an unique id name subgrid_table_id based on the subgrid_id. For example

    var subgrid_table_id = subgrid_id+"_t";
    

    instead of var subgrid_table_id; only.

    Nevertheless some things I find a little suspected:

    1. I don’t understand why you return return false; from the successfunc. It means that you interpret the server response as an error and the normal actions on successful server response should be interrupted. I would recommend you additionally use errorfunc parameter of saveRow. In my server code the server always return error HTML status code in case of the server error. So I never need use successfunc and use aftersavefunc and errorfunc only.
    2. The subgrid has many column which already exist in the corresponding row of the parent grid. The potential problems here are not only spending of additional memory. You don’t posted the grid data and so I don’t know what values you use as rowids for grids. It is very important to have no id duplicates on the HTML page. So you should be careful in the subject. Why you need ? Probably you can just use extraparam parameter of saveRow and editRow instead of the usage of phrase_id, translation_id and language_cd hidden columns having editable: true, editrules: { edithidden :true }, hidden: true properties?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.