Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. dropdown edit type selection to read mode for few records.

dropdown edit type selection to read mode for few records.

Scheduled Pinned Locked Moved JavaScript
cssdatabasehtmljsontutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    parkway
    wrote on last edited by
    #1

    hi, I have a requirement in the jqgrid data that totally 3 columns in that one is name,date and one column called department where the edit type is select have two options education and humanresources. for some records like up to this month 10/31 the records should be editable , i mean we can select some thing and we can update. only the current month should be editable and next month data should not editable we can view it but not edit just like should be in read mode. How to approach this scenario? $("#grid").jqGrid({ url: 'Handler.ashx', datatype: 'json', height: 250, colNames: ['Name','Department', 'Date'], colModel: [ { name: 'Name', index: 'Name', width: 256, stype: 'text', editable: true, sortable: false, editoptions: { disabled: "disabled"} }, { name: 'Department', index: 'Department', width: 256, stype: 'text', sortable: false, editable: true, edittype: 'select', formatter: rowColorFormatter, editoptions: { value: "Education:Education; Humanresource:Humanresource" }}, { name: 'Date', index: 'Date', width: 256, editable: true, stype: 'text', sortable: true, sorttype: 'date', editoptions: { disabled: "disabled"} } ], rowNum: 100, loadonce: true, rowList: [100, 200, 300], pager: '#pager', sortname: 'name', viewrecords: true, sortorder: 'asc', gridview: true, ignoreCase: true, caseSensitive: false, rownumbers: true, reloadAfterSubmit: false, width: 1024, gridComplete: function() { for (var i = 0; i < rowsToColor.length; i++) { var Department = $("#" + rowsToColor[i]).find("td").eq(2).html(); if (Department == "Humanresource") { $("#" + rowsToColor[i]).find("td").css("background-color", "red"); } } }, jsonReader: { repeatitems: false }, caption: 'Department Update', editurl: 'Handler.ashx', onSelectRow: function(id) { if (id && id !== lastSelectedId) { $('#grid').restoreRow(lastSelectedId); $('#grid').editRow(id, true); lastSelectedId = id; } }, afterSubmit: function() { $(this).jqGrid("setGridParam", { datatype: 'json' }); return [true]; alert("returnvalue"); } }); function rowColorFormatter(cellValue, options, rowObject) { if (cellValue == "Humanresources") rowsToColor[rowsToColor.length] = options.rowId; return cellValue; }; $("#grid").setGridParam({ sortname: 'CalDate', sortorder: 'asc' }).trigger('reloadGrid'); $("#grid").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false, search: true, searchtext: "Search", reloadAfterSubmit: true, cloneToTop: true, overlay: false, beforeRefresh: functio

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups