LoginSignup
5
3

More than 5 years have passed since last update.

jqGridのSelectBoxにnull値をセットする方法

Last updated at Posted at 2013-09-11

"0:hoge;1:fuga"の初期値(1番頭)をnull値にしたい

こんな感じで各値を指定できますので、"0:hoge;1:fuga"

以下の感じで:;を追記してやればいいみたいです。

":;0:hoge;1:fuga"

全体的にみると、以下の様な感じ。

var XXX=':;0:hoge;1:fuga';
$('#table').jqGrid({
  colModel:[ 
    {index:'X',name:'X',editable:true,edittype:"select",editoptions:{value:XXX},formatter:'select'}, 
  ]
});

jqGridについて思ったこと

jqGridは汎用性高い分、オプションの数が半端ないので学習コストがそれなりに掛かる印象。
その分、メンテナンスし易く規則的で綺麗なコードでtableが扱えます。
巨大で複雑なtableで扱う場合、使えるか否か調査に十分な時間を割いて検証し、
使えるようなら使った方がいいと思います。

jqGridの書籍も出ているみたいです
洋書しかないみたいですが、買うか迷うなぁ。

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3