Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/417.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 重写服务器端定义的JQGrid参数_C#_Javascript_Jquery Plugins_Jqgrid - Fatal编程技术网

C# 重写服务器端定义的JQGrid参数

C# 重写服务器端定义的JQGrid参数,c#,javascript,jquery-plugins,jqgrid,C#,Javascript,Jquery Plugins,Jqgrid,我正在处理一个表的CSS,该表是使用C#在服务器端通过JQGrid生成的。我试图覆盖客户端的布局定义(例如宽度)(当然是在代码中生成服务器端表之后),但没有得到任何结果。唯一有效的方法是创建一个全新的jqgrid对象,它显然会使所有服务器端定义无效,因此没有任何用处 有没有办法在客户端重新生成对象的JavaScript副本,然后对其应用更改 非常欢迎您的帮助 编辑: 下面是用C#生成表的代码: this.projectGrid=新JQGrid { 列=新列表() { 新JQGridColumn{

我正在处理一个表的CSS,该表是使用C#在服务器端通过JQGrid生成的。我试图覆盖客户端的布局定义(例如宽度)(当然是在代码中生成服务器端表之后),但没有得到任何结果。唯一有效的方法是创建一个全新的jqgrid对象,它显然会使所有服务器端定义无效,因此没有任何用处

有没有办法在客户端重新生成对象的JavaScript副本,然后对其应用更改

非常欢迎您的帮助

编辑: 下面是用C#生成表的代码:

this.projectGrid=新JQGrid
{
列=新列表()
{
新JQGridColumn{Visible=true,
可编辑=假,
//宽度=70,
DataField=“合规性”,
HeaderText=“Comp.”,
Searchable=false,
格式化程序=新的自定义格式化程序
{
FormatFunction=“formatCmpImage”
}
},
新的JQGridColumn{DataField=“ProjectID”,
PrimaryKey=true,
可见=真,
可编辑=假,
HeaderText=“ID”,
//宽度=50,
可搜索=错误
},
新的JQGridColumn{DataField=“OpsRegion”,
可见=真,
可编辑=假,
HeaderText=“运营区域”,
//宽度=180,
可搜索=错误
},
新的JQGridColumn{DataField=“customer”,
可见=真,
可编辑=假,
HeaderText=“客户名称”,
//宽度=180,
可搜索=错误
},
新建JQGridColumn{DataField=“projectName”,
可见=真,
可编辑=假,
HeaderText=“项目名称”,
//宽度=300,
Searchable=false,
格式化程序=新的自定义格式化程序
{
FormatFunction=“formatLink”,
}
},
新建JQGridColumn{DataField=“projectManager”,
可见=真,
可编辑=假,
HeaderText=“项目经理”,
//宽度=110,
可搜索=错误
},
新的JQGridColumn{DataField=“status”,
可见=真,
可编辑=假,
HeaderText=“状态”,
//宽度=70,
可搜索=错误
},
新的JQGridColumn{DataField=“type”,
可见=真,
可编辑=假,
HeaderText=“Type”,
//宽度=70,
可搜索=错误
},
新建JQGridColumn{DataField=“favorite”,
可见=真,
可编辑=假,
HeaderText=“收藏夹”,
//宽度=60,
Searchable=false,
格式化程序=新的自定义格式化程序
{
FormatFunction=“formatFvImage”,
UnFormatFunction=“unformatCell”
}
},
新JQGridColumn{DataField=“compliance\u reason”,
可见=假
},
新建JQGridColumn{DataField=“lastUpdate”,
可见=真,
可编辑=假,
//宽度=60,
HeaderText=“上次更新”,
Searchable=false,
格式化程序=新的自定义格式化程序
{
FormatFunction=“formatReportLink”,
UnFormatFunction=“unformatCell”
}
},
},
宽度=单位像素(1400),
ShrinkToFit=真,
高度=单位像素(520),
};

如果需要更改网格的宽度,可以使用该方法。要覆盖许多其他jqGrid选项,可以改用
setGridParam
。可以在创建网格后使用这些方法。基因中
        this.projectGrid = new JQGrid
        {
            Columns = new List<JQGridColumn>()
            {
                new JQGridColumn { Visible=true,
                                   Editable=false,
                                 //  Width=70,
                                   DataField="compliance_colour",
                                   HeaderText="Comp.",
                                   Searchable=false,
                                    Formatter = new CustomFormatter
                                                             {
                                                              FormatFunction = "formatCmpImage"

                                                             }


                },
                new JQGridColumn{ DataField="ProjectID",
                                  PrimaryKey=true,
                                  Visible=true,
                                  Editable=false,
                                  HeaderText="ID",
                                //  Width=50,
                                  Searchable=false
                },
                new JQGridColumn{ DataField="OpsRegion",
                                  Visible=true,
                                  Editable=false,
                                  HeaderText="Ops Region",
                               //   Width=180,
                                  Searchable=false

                },
                  new JQGridColumn{DataField="customer",
                                 Visible=true,
                                 Editable=false,
                                 HeaderText="Customer Name",
                               //  Width=180,
                                 Searchable=false

                },
                  new JQGridColumn{ DataField="projectName",
                                  Visible=true,
                                  Editable=false,
                                  HeaderText="Project Name",
                                //  Width=300,
                                  Searchable=false,
                                  Formatter = new CustomFormatter
                                                             {
                                                              FormatFunction = "formatLink",

                                                             }


                },

                new JQGridColumn{DataField="projectManager",
                                 Visible=true,
                                 Editable=false,
                                 HeaderText="Project Manager",
                              //   Width=110,
                                    Searchable=false
                },
                new JQGridColumn{DataField="status",
                                 Visible=true,
                                 Editable=false,
                                 HeaderText="Status",
                              //   Width=70,
                                 Searchable=false

                },
                new JQGridColumn {DataField="type",
                                  Visible=true,
                                  Editable=false,
                                  HeaderText="Type",
                             //     Width=70,
                                  Searchable=false

                },
                new JQGridColumn {DataField="favorite",
                                  Visible=true,
                                  Editable=false,
                                  HeaderText="Favorite",
                              //    Width=60,
                                  Searchable=false,
                                  Formatter = new CustomFormatter
                                                                {
                                                                    FormatFunction = "formatFvImage",
                                                                    UnFormatFunction = "unformatCell"
                                                                }

                },
                 new JQGridColumn {DataField="compliance_reason",
                                  Visible=false      
                },
                 new JQGridColumn {DataField="lastUpdate",
                                  Visible=true,
                                  Editable=false,
                               //   Width=60,
                                  HeaderText="Last Update",
                                  Searchable=false,
                                  Formatter = new CustomFormatter
                                                                {
                                                                    FormatFunction = "formatReportLink",
                                                                    UnFormatFunction = "unformatCell"
                                                                }

                },
            },
           Width = Unit.Pixel(1400),
            ShrinkToFit=true,
            Height = Unit.Pixel(520),

        };