Skip to content

Commit

Permalink
Initial version from git@github.com:reebalazs/SlickGrid-bootstrap.git…
Browse files Browse the repository at this point in the history
… bootstrap-support branch
  • Loading branch information
reebalazs committed Apr 4, 2013
0 parents commit 5ccefa4
Show file tree
Hide file tree
Showing 16 changed files with 1,624 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gitk*
.idea/*
.DS_Store
node_modules
*.sublime-project
*.sublime-workspace
39 changes: 39 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
'default': {
options: {
paths: ['examples', 'bootstrap', 'lib/bootstrap'],
yuicompress: false
},
files: {
'examples/example-bootstrap.css': [
'examples/example-bootstrap.less'
]
}
}
},
watch: {

'default': {
options: {
debounceDelay: 250
},
files: ['examples/*.less', 'bootstrap/*.less'],
tasks: ['less:default']
}
}
});

// Load plugins.
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');

// Default tasks.
grunt.registerTask('default', ['less:default']);

};
20 changes: 20 additions & 0 deletions MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2010 Michael Leibman, http://github.com/mleibman/slickgrid

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SlickGrid BootStrap support

Support to make SlickGrid work with Twitter Bootstrap styles.

To learn about SlickGrid, please check out [the wiki](/mleibman/SlickGrid/wiki).

## SlickGrid is an advanced JavaScript grid/spreadsheet component

89 changes: 89 additions & 0 deletions bootstrap/bootstrap-slickgrid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

(function ($) {

"use strict"; // jshint ;_;

/*global Slick: true*/

/* SlickGrid PUBLIC CLASS DEFINITION
* ================================= */

var SlickGrid = function ( element, options ) {
element = $(element);
var cookedOptions = $.extend(true, {},
$.fn.slickgrid.defaults, options);
this.init('slickgrid', element, cookedOptions);
};

SlickGrid.prototype = {

constructor: SlickGrid,

init: function (type, element, options) {
var self = this;
this.element = $(element);
this.wrapperOptions = $.extend(true, options, {
// always render without ui-* css styles
slickGridOptions: {jQueryUiStyles: false}
});
this.postInit();
},

postInit: function () {
// Call the provided hook to post-process.
(this.wrapperOptions.handleCreate || this.handleCreate).apply(this);
},

handleCreate: function () {
// Create a simple grid configuration.
//
// This handler will run after the options
// have been preprocessed. It can be overridden by passing
// the handleCreate option at creation time.
//
// Variables you can access from this handler:
//
// this: will equal to the SlickGrid object instance
// this.element: the element to bind the grid to
// this.wrapperOptions: options passed to this object at creation
//
// this.wrapperOptions.slickGridOptions: options for Slick.Grid
//
var o = this.wrapperOptions;
var grid = new Slick.Grid(this.element, o.data,
o.columns, o.slickGridOptions);
}

};

/* SlickGrid PLUGIN DEFINITION */

$.fn.slickgrid = function (option) {
return this.each(function () {
var $this = $(this),
data = $this.data('slickgrid'),
options = typeof option == 'object' && option;
if (!data) {
$this.data('slickgrid', (data = new SlickGrid(this, options)));
}
if (typeof option == 'string') {
data[option]();
}
});
};

$.fn.slickgrid.Constructor = SlickGrid;

$.fn.slickgrid.defaults = {
slickGridOptions: {},
columns: [], // Column meta data in SlickGrid's format.
handleCreate: null // This handler is called after the grid is created,
// and it can be used to customize the grid.
// Variables you can access from this handler:
//
// this: will equal to the SlickGrid object instance
// this.element: the element to bind the grid to
// this.wrapperOptions: options passed to this object at creation
};

})(window.jQuery);
175 changes: 175 additions & 0 deletions bootstrap/slickgrid.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@

/* Mixins for SlickGrid */

/* Used from variables.less:
*
* @baseFontSize (unless, font size is passed as an option)
* @tableBorder
* @linkColor
* @tableBackgroundAccent
* @textColor
* @navbarLinkColorHover
*
* This means that if you have an updated variable.less, the grid will
* follow your changes.
*
* Example usage:
*
*
@import "variables.less";
@import "../bootstrap/slickgrid.less";
.grid {
// Set dimensions
height: 380px; // for 10 rows x 35px
width: 800px;
// Apply all grid styles
.SlickGrid();
// Add a bottom border to the grid.
border-bottom: 1px solid @tableBorder;
}
*
*/

.SlickGrid (@fontSize:@baseFontSize,
@headerColumnHeight:20px) {

position: relative;

.SlickCell () {
// reset some essentials.
       padding: 5px 7.5834px;
font-size: @fontSize;
td {
font-size: @fontSize;
}
body & {
line-height: 20px;
}
   }

// Reset the margin of the checkboxes. The grid
// needs a selection checbox column. Bootstrap gives
// these elements a 4px top margin, which we have to reset
// by aligning to baseline.
input[type="checkbox"] {
vertical-align: baseline;
margin: 0;
}

.slick-viewport {
// Add a top border to visually separate the headers.
border-top: 1px solid @tableBorder;
}

.grid-canvas {
.slick-row {
border: 0 none;
position: absolute;
width: 100%;
}
.slick-cell, .slick-headerrow-column {
border-top: 0;
border-bottom: 1px solid @tableBorder;
border-left: 0;
border-right: 0;
}
.even {
background: @tableBackgroundAccent;
}


/* XXX ... needed ? */
.slick-cell {
.SlickCell ();
a, a:visited, .ui-widget-content a, .ui-widget-content a:visited {
color: @linkColor;
text-decoration: none;
}
a:hover, .ui-widget-content a:hover {
color: @linkColorHover;
text-decoration: none;
border-bottom: none;
}
table {
height: 100%;
border: 0 none;
padding: 0;
background: none;
}
td {
border: 0 none;
padding: 0;
vertical-align: middle;
text-align: left;
}
}
}

.slick-header {
border-top: 0;
border-bottom: 0;
}

.slick-header-columns {
background: @tableBackground;

.slick-header-column {
height: @headerColumnHeight;
line-height: @fontSize;
margin: 0;
border: 0;
&.ui-state-default {
.SlickCell ();
}

@slickgridHoverHeaderColor: @textColor;
@slickgridSortingHeaderColor: @textColor;

.ResetColumns () {
/* like TH */
background: @tableBackground;
font-family: @sansFontFamily;
color: @textColor;
font-weight: bold;
text-shadow: 0 -1px 0 rgba(0,0,0,.4);
a, a:visited {
color: @textColor;
}
a:hover {
color: @slickgridHoverHeaderColor;
}
}

.ResetColumns ();
&.ui-state-default {
.ResetColumns ();
}

&.slick-header-column-sorted {
font-style: normal;
color: @slickgridSortingHeaderColor;
}
&:hover {
color: @slickgridHoverHeaderColor;
}

.slick-sort-indicator-asc {
vertical-align: middle;
//&:before {
// border-top: 0;
// border-bottom: .266666667em solid #fff;
//}
           }

           .slick-sort-indicator-desc {
vertical-align: middle;
           }

}
}

}
Loading

0 comments on commit 5ccefa4

Please sign in to comment.