次のパブリック クラスを作成したcolModelClass
ので、自分の colModel 文字列を逆シリアル化できます。jqgrid
public class colModelClass
{
public string name { get; set; }
public string index { get; set; }
public string jsonmap { get; set; }
public bool editable { get; set; }
public bool sortable { get; set; }
public int width { get; set; }
public string align { get; set; }
public bool hidden { get; set; }
public string sorttype { get; set; }
public string formatter { get; set; }
public string formatoptions { get; set; }
}
問題は、formatoptions
文字列ではないということです。可能なアイテムの数に制限がないjson
オブジェクトです。formatoptions
に同梱されている各標準アイテムを含めることができるだけでなくjqgrid
、カスタム オプションを含めることもできます。
次のようなオブジェクトを許可するType
ために使用するものは次のとおりです。formatoptions
{ "srcformat": "m/d/Y", "newformat": "m/d/Y" }
またはこれ
{ "decimalSeparator":".","thousandsSeparator":"," }
または他のオプションの数と組み合わせ (オプションを追加してもクラスを更新する必要はありません)?
formatoptionsClass
または、クラスを動的に構築できるように、文字列、bool、int などを受け入れるクラスを作成するにはどうすればよいですか?