4

How do I put two SlickGrid grids on one page? Just having one slickgrid (jquery control) requires a lot of particular commands and the use of a nameless function (it seems). So what if I want two controls or more on one page?

there is something about the jquery function declaration:

$(function () {

that seems to prevent this from workinging. It is not really a function declaration. So there cannot be a $(function2 () { for the second grid.

By just duplicating the content for a second grid in the example code, I get somethnig that is umproductive. Can you see where I go wrong?

enter code here

Well, that did not work. I will have to ftp the code and post a link to it on a web site.

xarzu
  • 8,657
  • 40
  • 108
  • 160

2 Answers2

1

I'm not quite sure if I understand your issue. You can create as many instances of Slick.Grid as you wish:

var grid1 = new Slick.Grid("#firstGrid", someData, someColumns, someOptions);
var grid2 = new Slick.Grid("#secondGrid", otherData, otherColumns, otherOptions);
idbehold
  • 16,833
  • 5
  • 47
  • 74
  • I have tried everythign I can think of and the second grid comes up empty. I will start with something simple. I will add the example3-editing.html example code here with a simple duplication of the second grid if I cannot get it working... – xarzu Aug 02 '13 at 00:25
0

I agree with idbehold's answer. You can create and display multiple slickgrids on one page.

eg. Your .js file must resemble

var grid1;
var data1=[];
var columns1=[ //relevant code ];

var grid2;
var data2=[];
var columns2=[ //relevant code ];

var options={ //relevant code }; //You can also create separate options for each grid,
                                 //but take care to include those as arguments when                                                                   
                                 //initializing the grid.

$ function() {
// relevant code
grid1 = new Slick.Grid("#myGrid1", data1, columns1, options); //or options1
grid2 = new Slick.Grid("#myGrid2", data2, columns2, options); //or options2
// more code
}

Note: Please take care to close all the brackets correctly. Above is just to show the way your code should be. I have tried using such kind of code successfully.

Vabbs
  • 107
  • 14