0

我使用 MVC jqGrid 创建网格,这是我填充网格的代码

var jsonData = new
        {
            total = formTemplatePage.TotalEntriesCount / (pageSize + childrenCount) + 1,
            page = gridSettings.PageIndex,
            rows = (
                       gridData.Select(c => new
                       {
                           id = c.Item.Id,
                           cell = new[]
                                                                    {
                                                                        c.Number,
                                                                        c.Item.Name,
                                                                        c.Item.Id.ToString(), 
                                                                        c.Item.Active.ToString(),
                                                                        c.Level,
                                                                        c.ParentId,
                                                                        c.IsLeaf,
                                                                        c.Expanded,
                                                                        c.UnKnown,
                                                                    }
                       })).ToList()
        };

但我怎么才能得到c.Item.Active == true呢?

4

1 回答 1

1

您可以简单地将行的选择更改为

gridData.Where(c => c.Item.Active).Select([...]);
于 2013-10-18T14:18:19.457 回答