vendredi 5 août 2016

Checkbox in Jqgrid is not checked

I am using - license jqGrid 4.4.4 - jQuery Grid (version 4.4.4) with MVC 5.

I create a checkbox column from my controller which I try to set as checked. So far I have tried:

list.Add(new {name = x.SecondOpinionGroupId.ToString(), index = "Grupp" + counter, sorttype = "string", sortable = false, hidden = false, editable = true, edittype = "checkbox", editoptions = new { value = "1:0", defaultValue ="1" }, formatoptions = new { disabled = "false", value="0:1" }, formatter = "checkbox" });

And

list.Add(new {name = x.SecondOpinionGroupId.ToString(), index = "Grupp" + counter, sorttype = "string", sortable = false, hidden = false, editable = true, edittype = "checkbox", editoptions = new { value = "1:0", defaultValue ="1" }, formatter = "checkbox" });

I have tried to use "Yes:No" and "True:False" as well but no luck. I am also trying to set the value dynamically by the action that is called from jqgrid. For all other columns i recieve a value but not for the checkbox.

     users.Item1.ForEach(x =>
            {
                int counter = 1;

                var item = new Dictionary<string, object>();
                item.Add("SecondOpionUserId", x.UserID);
                item.Add("Deltagare", x.UserID);
                meeting.SecondOpinionGroup.OrderBy(y => y.SecondOpinionGroupId).ForEach(z =>
                {

                    item.Add("Grupp" + counter, "1");
                    counter++;
                });

                jsonData.Data.Add(item);
            });

What am I doing wrong?




Aucun commentaire:

Enregistrer un commentaire