Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
445
Grid checkbox column on click for edit
posted

Hi,

I'm using grid and I have a checkbox column. When I want to modify a checkbox, I have to click once for enter to edit mode, then click on checkbox to change the value, then I have to press enter or click outside the row to save the column.

I want to ask if there is any option to make it in one click.

I thought about using javascript codes to make it automaticly

$(document).delegate("#pcd-grid", "iggridupdatingeditcellstarting", function (evt, ui)

do everything end close modification, save everything.

@(Html.Infragistics()

    .Grid<Model>()

    .ID("pcd-grid")

    .AutoGenerateColumns(false)

    .RenderCheckboxes(true)

    .PrimaryKey("id")

    .EnableUTCDates(false)

    .Columns(column =>

    {

column.For(x => x.IsValid).HeaderText(“isvalid”).Width("5%").DataType("bool");

 

 

features.Updating()

            .EditMode(GridEditMode.Cell)

            .StartEditTriggers(GridStartEditTriggers.Click)

            .EnableDeleteRow(false)

            .EnableAddRow(false)

            .ShowDoneCancelButtons(true)

            .ColumnSettings(cs =>

            {

.Grid<CandidateModel>()

.ID("pcd-grid")

.AutoGenerateColumns(false)

.RenderCheckboxes(true)

.PrimaryKey("CandidateID")

.EnableUTCDates(false)

.Columns(column =>

{

column.For(x => x.CandidateID).Column.Hidden = true;

  • 2525
    posted

    Hello,

    This is due to the design of the grid requiring to first enter edit mode and then being able to edit the contents of the cell. This can be achieved by handling the editCellStarting event and toggling the cell's value. Here is an example of how to do so:

    editCellStarting: function(evt, ui){
                         if(ui.columnKey === "MakeFlag"){
                           ui.value = !ui.value;
                          }
    }

    Here is a fiddle with the desired behavior: http://jsfiddle.net/y0edpmm8/

    Let me know if you have any questions.