Zggb
Zggb

Reputation: 47

jquery-datatables-rails. responsive extention and mobile view

I use:

rails 4.2.1 
gem 'jquery-datatables-rails', '~> 3.3.0'
gem 'ajax-datatables-rails', '~>0.3.0'
gem 'bootstrap-sass', '~> 3.3.5'

Responsive extra works at normal browser window, when I resize. But doesn't work on mobile phones or in mobile view in chrome.

I'm was trying:

  1. disable bootstrap-sass
  2. change responsive extra from 1.0.5 to 1.0.7

when I try to look table from datatables.net in mobile mode, everything is OK
Screenshots here

Upvotes: 3

Views: 399

Answers (1)

Gyrocode.com
Gyrocode.com

Reputation: 58880

Add this in your HTML after <head> tag:

<meta name="viewport" content="width=device-width,initial-scale=1">

According to the documentation:

A typical mobile-optimized site contains something like the following:

<meta name="viewport" content="width=device-width, initial-scale=1">

The width property controls the size of the viewport. It can be set to a specific number of pixels like width=600 or to the special value device-width value which is the width of the screen in CSS pixels at a scale of 100%. (There are corresponding height and device-height values, which may be useful for pages with elements that change size or position based on the viewport height.)

The initial-scale property controls the zoom level when the page is first loaded. The maximum-scale, minimum-scale, and user-scalable properties control how users are allowed to zoom the page in or out.

Upvotes: 1

Related Questions