Welcome Guest, Not a member yet? Register   Sign In
Flexigrid - Lightweight but rich data grid

[eluser]paulopmx[/eluser]
[quote author="Armorfist" date="1216843314"][quote author="justinkelly" date="1216701279"]re [quote author="justinkelly" date="1216643332"]Hi Guys,

first - thanks for the great flexigrid!!
- i was starting to use extgrid but this is a nicer option

just a quick question for you guys
- is it possible to set the column width in % rather than px in flexigrid?
- i've had a play around and looked in the flexigrid.js etc. but couldn't see anything

Cheers

Justin[/quote]

to try and make this work i edited flexigrid.js and changed it from px to % (refer below)
############
line 960 $(thdiv).css({textAlign:this.align, width: this.width + '%'});
############

the outcome of this is that the div widths for the columns now show up as %

grid html
#### TH ####
<th class="sorted" align="center" abbr="id" axis="col0">
<div class="sasc" style="text-align: center; width: 40%;">ID</div>
</th>
#### TD ####
<td class="sorted" align="center">
<div style="text-align: center; width: 40%;">1</div>
</td>

but this didn't work/display correctly - anyone got any suggestions on how to make column % width work?

Cheers

Justin[/quote]

Did anyone figure this out? I'm trying to do this too but without success. Getting really frustrated Tongue
Thanks[/quote]

Hi guys,

I didn't really design flexigrid to use % sizes as the dragndrop and resizing functions are dependent on accurate per pixel measurements.

Paulo

[eluser]paulopmx[/eluser]
[quote author="Armorfist" date="1216844611"]Oh and paulo:

In the next release can you include the string "Quick Search" and "Clear" from the search box feature as a property like "pagestat"?
I have to manually change this in every release

Thanks![/quote]

Sure, no problem, someone also suggested the post variables can be renamable as well, i'll publish these two updates together.

[eluser]paulopmx[/eluser]
[quote author="TheJayL" date="1216669262"]Ok I found a major issue with my code. The grid breaks when I include an ajax function that I created. When I reorder the columns: Basically at the end of DragEnd I call my ajax function to store the new column order. Everything seems to look and work fine and my code writes out the sessions vars. If I reload the page it stays the way I left it.

However, if I use any of the grids functions like next page or change the rows per page or show/hide columns (basically anything the grid reloads the data but not the whole page) I get errors in the grid. They all are linked to this one action of mine. The biggest error is that the grid populates, but with the old column order. The headers are still correct, but the actual data is not. So my columns are not matching up. Once I reload, everything looks and operates as it should until I use one of the built in Flexi operations again.

This makes me think either the JS is taking care of managing its own column layout, independent of the XML, or my ajax command is somehow breaking the JS and not allowing it to update itself. Once I take out the Ajax it all works great.

I have also checked the XML after the columns have been reordered and it is correct, and I have "alerted" the column titles after the Grid populates, both are correct. My leaning towards something going haywire in this like of code, but not sure:

td[removed] = $("cell:eq("+ idx +")",robj).text();

Any ideas as to where to look would be great.[/quote]

Hi,

Ok the ordering works like this: at initial setup, the ordering of columns is base on the order of your colModel, and stored on the axis attribute. This must then be match by your backend. Now once the user reorders the columns and data is repopulated, the script looks at your old order and base the ordering through that.

Now to using your session vars, dynamically order the loading of the colModel using PHP base on your session vars, and on the backend dynamically order the columns base on your session vars as well.

Paulo

[eluser]paulopmx[/eluser]
[quote author="tof" date="1216757662"]hello,
i'm going to use flexigrid for my new programs.
however, i would like to dynamically parse the grid's attributes to add new functions to the grids (printing, csv output, etc).
i've passed the all day trying to get the colModel definition but i didnt succeed.
i want to get the colModel definition, the sortname & sortorder attributes, in javascript, so that i can generate the sql command coresponding to the user choices once he had played with the grid appearance...
maybe someone here can help me ?[/quote]

I actually don't understand why you need the grid's attributes to add new functions of (printing, csv output, etc).

But to get the attributes try this custom api method

Code:
$.fn.flexAttr = function(p) {

        return this.each( function() {
                if (this.grid) return this.p;
            });

    };

[eluser]paulopmx[/eluser]
[quote author="Wallcrawler" date="1216883029"]Hi guys!

First of all, flexigrid is a superb jquery plugin!

But i´m facing some troubles to get it work perfectly.

Please see the page http://www.goldmaxbrasil.com.br/desenvol...itacao.asp, and click in "mostrar" button.

The flexgrid is shown, but the margin of each header didn't match with the rows. If you access this page using IE7 more visual problems is shown. What have i done wrong?

Otherwise, how can i put a function to be executed when the user select one row?

Thank you![/quote]

Can't access your link. But it could be a CSS conflict problem.

for single select, use the new option { singleSelect: true } when creating your flexigrid.

[eluser]paulopmx[/eluser]
[quote author="dave_in_chapelhill" date="1216803055"]In reply to my own prior post...

Apparently, showTableToggleBtn and showToggleBtn are distinct. Thus, there should be a showTableToggleButton default in parameters at top of flexigrid.js.

Further, to address the JS error mentioned when hover over header column name when showToggleBtn is false:
Node cannot be inserted at the specified point in the hierarchy" code: "3
[Break on this error] this.appendChild( a );

I fixed this, tho probably not optimally, by two edits in flexigrid.js:

Comment out/change:
Code:
//            if (p.showToggleBtn) $(g.gDiv).prepend(g.nBtn);
            $(g.gDiv).prepend(g.nBtn);

Wrap an 'if' around hover processing:
Code:
if (p.showToggleBtn) // DLC patch
{
  (g.nDiv).hide();$(g.nBtn).hide();
  $(g.nBtn).css({'left':nl,top:g.hDiv.offsetTop}).show();
  var ndw = parseInt($(g.nDiv).width());
  $(g.nDiv).css({top:g.bDiv.offsetTop});
  if ((nl+ndw)>$(g.gDiv).width())
    (g.nDiv).css('left',onl-ndw+1);
  else
    $(g.nDiv).css('left',nl);
  if ($(this).hasClass('sorted'))
    $(g.nBtn).addClass('srtd');
  else
    $(g.nBtn).removeClass('srtd');
}
[/quote]

thanks for the heads up.

[eluser]Armorfist[/eluser]
paulo:
Is it possible, by abdicating the "drag" and "resize" features, to be able to size the columns in %?

Thanks

[eluser]paulopmx[/eluser]
[quote author="Ibere" date="1216421076"]Hi, I'm triing to use flexigrid, in the easy way... (without json or ajax), just a simple table (with all TRs and TDs tag), and in the flexigrid starter I had assigned buttons to test function, but when I try to retrieve a row reference (id), i get an empty string..
The script that I am using to get the list, is the same script that was posted early in this forum.
var items = $('.trSelected',grid);
var itemlist ='';
for(i=0;i<items.length;i++){
itemlist+= items[i].id.substr(3)+",";
}
alert("Items selected: "+itemlist);

and the start of flexigrid is:

$('#users').flexigrid(
{ colModel:[{display: 'id',name: 'id', width : 100, sortable : true, align: 'left'},
{display: 'Login',name: 'login', width : 100, sortable : true, align: 'left'},
{display: 'Nome',name: 'nome', width : 400, sortable : true, align: 'left'} ],
buttons : [ {name: 'Add', bclass: 'add', onpress : test},
{name: 'Delete', bclass: 'delete', onpress : test},
{name: 'Alter', bclass: 'change', onpress : test} ],
searchitems : [ {display: 'Login', name : 'login', isdefault: true},
{display: 'Nome', name : 'nome'} ],
sortname: "id", sortorder: "asc", title: 'Users table', width: 520, height: 400 } )

well.. what I am doing wrong ? how can I know what row was selected when test function is called ?
sorry about my poor english... is not my native language (I'm brazilian).. and thanks a lot
ah.. and congratulations about your amazing project...[/quote]

Reference id comes from dynamic data which adds a id="row"+id on every row. you can load this yourself on your static table by adding an id on your row in this format: 'row' + id.

[eluser]paulopmx[/eluser]
[quote author="millercj" date="1216546074"]I've been using flexigrid for a few different projects and I recently cut/pasted it into one i'm working on now but i've got some sort of glitch that i can't locate. What is happening is the column headers and the data columns are displaying with different widths. Any ideas?

I just re-downloaded the CSS from the site and uploaded it as a double check, so it is the original css file, but that made no difference.[/quote]

This can be a CSS conflict. try removing your own css and see if it makes a difference. if it does, then you know there is a conflict.

[eluser]paulopmx[/eluser]
[quote author="Armorfist" date="1216907345"]paulo:
Is it possible, by abdicating the "drag" and "resize" features, to be able to size the columns in %?

Thanks[/quote]

Nope. for one thing the header and the main table is actually separate tables, that's how you get the scrolling while having the column headers stay. for another reason, one of the main problems i've had (and I'm sure the guys that makes this kind of grid had) with tables is that browsers handle table sizes differently, specially %. So to fix this, i handle the size setting of the columns by placing a div within the cell, and I resize that div not the cell.




Theme © iAndrew 2016 - Forum software by © MyBB