lib/jquery/gridify/grid_view.rb
def jqgrid_properties
      vals = {}
      vals[:ajaxGridOptions] = ajax_grid_options if ajax_grid_options

      # data and request options
      vals[:url] = url if url
      vals[:editurl] = url if editable
      vals[:restful] = true if restful
      vals[:inline_edit] = inline_edit if inline_edit.present?
      vals[:postData] = {:grid => name, :datatype => data_type} #identify which grid making the request
      vals[:colNames] = colNames if colNames.present?
      vals[:colModel] = column_model if colModel.present?
      vals[:datatype] = data_type if data_type
      if data_format.present?
        case data_type
          when :xml
            vals[:xmlReader] = data_format
          when :json
            vals[:jsonReader] = data_format
        end
      end

      vals[:loadonce] = load_once if load_once

      vals[:sortname] = sort_by if sort_by
      vals[:sortorder] = sort_order if sort_order && sort_by
      vals[:rowNum] = rows_per_page if rows_per_page
      vals[:rowTotal] = total_rows if total_rows
      vals[:page] = current_page if current_page

      # grid options
      vals[:height] = height if height
      vals[:gridview] = grid_view # faster views, NOTE theres cases when this needs to be disabled

      case width_fit
        when :fitted
          #vals[:autowidth]    = false #default
          #vals[:shrinkToFit]  = true #default
          vals[:forceFit] = true
          vals[:width] = width if width

        when :scroll
          #vals[:autowidth]    = false #default
          vals[:shrinkToFit] = false
          #vals[:forceFit]     = #ignored by jqGrid
          vals[:width] = width if width

        else #when :fluid
          vals[:autowidth] = true
          #vals[:shrinkToFit]  = true #default
          vals[:forceFit] = true
          #vals[:width]        = is ignored
          vals[:resizeStop] = 'javascript: gridify_fluid_recalc_width'
      end

      vals[:sortable] = true if arranger_type.include?(:sortable)

      # header layer
      vals[:caption] = title if title
      vals[:hidegrid] = false unless collapsible
      vals[:hiddengrid] = true if collapsed

      # row formatting
      vals[:altrows] = true if alt_rows
      vals[:altclass] = alt_rows if alt_rows.is_a?(String)

      vals[:rownumbers] = true if row_numbers
      vals[:rownumWidth] = row_numbers if row_numbers.is_a?(Numeric)

      if inline_edit
        vals[:scrollrows] = true
        vals[:multiselect] = true if multi_select
        vals[:onSelectRow] = "javascript: function(id, status) { if(id && id!==lastsel_#{dom_id}) { jQuery('##{dom_id}').jqGrid('restoreRow', lastsel_#{dom_id}); jQuery('##{dom_id}').jqGrid('editRow', id, true, #{inline_edit_handler}, #{error_handler}); lastsel_#{dom_id}=id}}"
      elsif select_rows #.present?
        vals[:scrollrows] = true
        vals[:onSelectRow] = select_rows
        vals[:multiselect] = true if multi_select
      else
        vals[:hoverrows] = false
        vals[:beforeSelectRow] = "javascript: function(){ false; }"
      end

      # pager layer
      if pager
        vals[:pager] = "##{pager}"
        vals[:viewrecords] = true # display total records in the query (eg "1 - 10 of 25")
        vals[:rowList] = paging_choices
        if paging_controls.is_a?(Hash)
          # allow override of jqGrid pager options
          vals.merge!(paging_controls)
        elsif !paging_controls
          vals[:rowList] = []
          vals[:pgbuttons] = false
          vals[:pginput] = false
          vals[:recordtext] = "{2} records"
        end
      end

      if tree_grid
        vals[:treeGrid] = tree_grid
        vals[:gridview] = true
        vals[:sortable] = false
      end

      #subgrid
      if sub_grid
        vals[:subGrid] = sub_grid
        vals[:subGridUrl] = sub_grid_url
        vals[:subGridModel] = sub_grid_model
        vals[:gridview] = true
      end

      #events
      #vals[:serializeGridData] = serialize_grid_data if serialize_grid_data

      vals[:loadonce] = load_once if load_once

      # allow override of native jqGrid options
      vals.merge(jqgrid_options)


    end
def jqgrid_properties
      vals = {}
      vals[:ajaxGridOptions] = ajax_grid_options if ajax_grid_options

      # data and request options
      vals[:url] = url if url
      vals[:editurl] = url if editable
      vals[:restful] = true if restful
      vals[:inline_edit] = inline_edit if inline_edit.present?
      vals[:postData] = {:grid => name, :datatype => data_type} #identify which grid making the request
      vals[:colNames] = colNames if colNames.present?
      vals[:colModel] = column_model if colModel.present?
      vals[:datatype] = data_type if data_type
      if data_format.present?
        case data_type
          when :xml
            vals[:xmlReader] = data_format
          when :json
            vals[:jsonReader] = data_format
        end
      end

      vals[:loadonce] = load_once if load_once

      vals[:sortname] = sort_by if sort_by
      vals[:sortorder] = sort_order if sort_order && sort_by
      vals[:rowNum] = rows_per_page if rows_per_page
      vals[:rowTotal] = total_rows if total_rows
      vals[:page] = current_page if current_page

      # grid options
      vals[:height] = height if height
      vals[:gridview] = grid_view # faster views, NOTE theres cases when this needs to be disabled

      case width_fit
        when :fitted
          #vals[:autowidth]    = false #default
          #vals[:shrinkToFit]  = true #default
          vals[:forceFit] = true
          vals[:width] = width if width

        when :scroll
          #vals[:autowidth]    = false #default
          vals[:shrinkToFit] = false
          #vals[:forceFit]     = #ignored by jqGrid
          vals[:width] = width if width

        else #when :fluid
          vals[:autowidth] = true
          #vals[:shrinkToFit]  = true #default
          vals[:forceFit] = true
          #vals[:width]        = is ignored
          vals[:resizeStop] = 'javascript: gridify_fluid_recalc_width'
      end

      vals[:sortable] = true if arranger_type.include?(:sortable)

      # header layer
      vals[:caption] = title if title
      vals[:hidegrid] = false unless collapsible
      vals[:hiddengrid] = true if collapsed

      # row formatting
      vals[:altrows] = true if alt_rows
      vals[:altclass] = alt_rows if alt_rows.is_a?(String)

      vals[:rownumbers] = true if row_numbers
      vals[:rownumWidth] = row_numbers if row_numbers.is_a?(Numeric)

      if inline_edit
        vals[:scrollrows] = true
        vals[:multiselect] = true if multi_select
        vals[:onSelectRow] = "javascript: function(id, status) { if(id && id!==lastsel_#{dom_id}) { jQuery('##{dom_id}').jqGrid('restoreRow', lastsel_#{dom_id}); jQuery('##{dom_id}').jqGrid('editRow', id, true, #{inline_edit_handler}, #{error_handler}); lastsel_#{dom_id}=id}}"
      elsif select_rows #.present?
        vals[:scrollrows] = true
        vals[:onSelectRow] = select_rows
        vals[:multiselect] = true if multi_select
      else
        vals[:hoverrows] = false
        vals[:beforeSelectRow] = "javascript: function(){ false; }"
      end

      # pager layer
      if pager
        vals[:pager] = "##{pager}"
        vals[:viewrecords] = true # display total records in the query (eg "1 - 10 of 25")
        vals[:rowList] = paging_choices
        if paging_controls.is_a?(Hash)
          # allow override of jqGrid pager options
          vals.merge!(paging_controls)
        elsif !paging_controls
          vals[:rowList] = []
          vals[:pgbuttons] = false
          vals[:pginput] = false
          vals[:recordtext] = "{2} records"
        end
      end

      if tree_grid
        vals[:treeGrid] = tree_grid
        vals[:gridview] = true
        vals[:sortable] = false
      end

      #subgrid
      if sub_grid
        vals[:subGrid] = sub_grid
        vals[:subGridUrl] = sub_grid_url
        vals[:subGridModel] = sub_grid_model
        vals[:gridview] = true
      end

      #events
      #vals[:serializeGridData] = serialize_grid_data if serialize_grid_data

      vals[:loadonce] = load_once if load_once

      # allow override of native jqGrid options
      vals.merge(jqgrid_options)


    end
generate the jqGrid initial values in json
   maps our attributes to jqGrid options; omit values when same as jqGrid defaults