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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:37:41+00:00 2026-05-16T17:37:41+00:00

I have a jqGrid where I want all the rows to be in edit

  • 0

I have a jqGrid where I want all the rows to be in edit mode. Under certain conditions, however, I want a cell in that row to be readonly based on some condition of the row data, but I can’t seem to get the grid to bend to my will (yet).

This is what I currently have.

$(grid).addRowData(...);  // omitted for clarity
$(grid).jqGrid('editRow',rowid);
if (someCondition){
     $(grid).setCell(rowid, 'col1', '', '', {editable: false});
}

The row is added and put into edit mode just as I want, but when it gets to the call to setCell(), it doesn’t seem to affect the cell.

Any ideas what I’m doing wrong here?

  • 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-16T17:37:42+00:00Added an answer on May 16, 2026 at 5:37 pm

    The grid was already using column formatters for other columns so I decided to go that route. I couldn’t get it to not change the entire column to readonly/editable using the method described by Oleg. I also decided to store readonly state as part of the grid cell value.

    colModel:

    { name: 'ARNumber', width: 70, editable: false, sortable: false, formatter: 'optionalReadonlyInputCellFormatter'},
    

    setup of my formatter/unformatter:

    $.extend($.fn.fmatter, {
        optionalReadonlyInputCellFormatter: formatOptionalReadonlyInputCell
    });
    
    $.extend($.fn.fmatter.optionalReadonlyInputCellFormatter, {
        unformat: unformatOptionalReadonlyInputCell
    });
    

    formatter/unformatter functions:

    function formatOptionalReadonlyInputCell(cellvalue, options, rowdata) {
        var readonly = cellvalue === undefined;
        if (readonly)
            return displayARNumberInput('');
    
        vals = cellvalue.split(",");
        var cellValue = vals[0];
        var readonly = !(vals[1] === undefined) || vals[1] == 1;
    
        if (readonly) {
            return displayARNumberSpan(cellValue);
        }
        else {
           return displayARNumberInput(cellValue);
        }
    }
    
    function unformatOptionalReadonlyInputCell(cellvalue, options, cellobject) {
        var readonly = (cellvalue == "") ? "0" : "1";
        if (readonly == "1") {
            return cellvalue + "," + readonly;
        }
        else {
            return $(cellobject).children().val() + "," + readonly;
        }
    }
    
    function displayARNumberInput(value) {
        var element = document.createElement("input");
        element.type = "text";
        element.value = value;
        return element.outerHTML;
    }
    
    function displayARNumberSpan(value) {
        var element = document.createElement("span");
        element.innerText = value;
        return element.outerHTML;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JQGrid that groups together certain rows. I use group to define
i starter in jqgrid, i want implement inline edit in jqgrid i have this
I have a jqGrid with only certain columns that are editable and I would
I have this ASP.Net Page with jqGrid, all what I want is to add
i have jqgrid in form , i want when user click in row this
I have a jqGrid with a subgrid. I want to sort the subgrid so
I have this mysql tables I want to display with jqgrid. The problem appears
hi all i have jqgrid and set update inline . i wrote this code
I have a jqgrid with the add dialog enabled for adding new rows. The
I have a few columns that are very long and i want to show

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.