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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:59:04+00:00 2026-06-12T07:59:04+00:00

i have this code and i have a little problem, when i edit, i

  • 0

i have this code and i have a little problem, when i edit, i have the rowid value in codSelected to send to my handler, its stored by onSelectRow event. If I edit a row, works well, but if edit one and inmediately i want to add a new one, i need this value (_codSelected) null, but it has the same value of the last edited row. I know that i can use addfunc in the pager, but if i use this, i cant use the popup window that jqGrid use by default.

Thanks.

$("#list").jqGrid({
    url: '/modulos/mantenimiento/Proveedores.ashx', 
    datatype: 'xml',
    mtype: 'GET',
    colNames: ['Codigo' //Some more colnames and colmodels]
    colModel: [
        { name: 'Codigo', index: 'PRg_Codigo', edittype: 'select',
            editable: true, editrules: { edithidden: false }, editoptions:
            { size: 30, dataUrl: '/modulos/mantenimiento/grupoProveedores.ashx?
            oper=selectAllGroups' }, sortable: true }
    ],
    onSelectRow: function (rowid) {
        _codSelected = rowid;
    },
    ajaxSelectOptions: {
        data: {
            codSelected: function () { 
                return _codSelected;
            }
        }
    }
});

jQuery("#list").jqGrid('navGrid', '#pager', {
    alerttext: "Seleccione un Servicio.",
    add: true, addtitle: "Crear nuevo Servicio",
    del: true, deltitle: "Eliminar Servicio",
    edit: true, edittitle: "Modificar Servicio",
    search: false, searchtitle: "Búsqueda",
    refresh: true,
    cloneToTop: true
},
{ width: 360, resize: false, closeAfterEdit: true, recreateForm: true,
    viewPagerButtons: true, afterComplete: muestraResultadoOperacion },
{ width: 360, resize: false, closeAfterAdd: true, recreateForm: true,
    viewPagerButtons: true, afterComplete: muestraResultadoOperacion },
{},
{ closeAfterSearch: true, closeOnEscape: true });
  • 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-12T07:59:06+00:00Added an answer on June 12, 2026 at 7:59 am

    I am not sure that I understand full your requirements.

    First of all _codSelected seems is the same as the value of internal selrow option of jqGrid. You can use $("#list").jqGrid("getGridParam", "selrow") to get the rowid of the last selected row. If you want to initialize the _codSelected variable to the value of the current selected row only in case of Edit dialog and set it to null in case of Add dialog you can do this inside of beforeInitData callback. The beforeInitData callback for Add dialog can set _codSelected to null and the same callback for Edit dialog can use _codSelected = $(this).jqGrid("getGridParam", "selrow");. It should solve your problem.

    UPDATED: To clear my suggestion I decide to post the following code:

    var _codSelected = null;
    
    // ...
    // here should be the definition of jqGrid where you removed
    // the current code of onSelectRow which changes _codSelected
    // ...
    
    jQuery("#list").jqGrid('navGrid', '#pager', {
        alerttext: "Seleccione un Servicio.",
        add: true, addtitle: "Crear nuevo Servicio",
        del: true, deltitle: "Eliminar Servicio",
        edit: true, edittitle: "Modificar Servicio",
        search: false, searchtitle: "Búsqueda",
        refresh: true,
        cloneToTop: true
    },
    { width: 360, resize: false, closeAfterEdit: true, recreateForm: true,
        beforeInitData: function () {
            // set _codSelected in case of Edit operation
            _codSelected = $(this).jqGrid("getGridParam", "selrow");
        },
        viewPagerButtons: true, afterComplete: muestraResultadoOperacion },
    { width: 360, resize: false, closeAfterAdd: true, recreateForm: true,
        beforeInitData: function () {
            // clear _codSelected in case of Add operation
            _codSelected = null;
        },
        viewPagerButtons: true, afterComplete: muestraResultadoOperacion },
    {},
    { closeAfterSearch: true, closeOnEscape: true });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little problem. This is my code: stackPanelShapesContainer = new StackPanel(); InitializeStackPanle();
its a little bit hard to understand. in the header.php i have this code:
I have taken this little snippet straight out of some code I'm working on:
I have this code for changing the image of a button: - (void)mouseEntered:(NSEvent *)event
I have this code: EditText value = ( EditText )findViewById( R.id.editbox ); Integer int_value
I have run into a rather weird little problem. In the following code I
I have a little problem with following VHDL code: process (zbroji) begin if rising_edge(zbroji)
This is a little bit of weird problem here. Say I have a C++
I have a little problem regarding arranging of code, which depends on each other
I have this code <div id=main style=background:#aaaaaa;float:left;height:160px;margin:5px;position:relative;display:block;width:630px;> <div id=1 class=item style=background:#ffaacc;float:left;width:200px;height:150px;margin:5px;position:absolute;left:0px;top:0px;> </div> <div id=2

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.