Welcome Guest, Not a member yet? Register   Sign In
Flexigrid Columns not sorting??
#1

[eluser]mjhan300[/eluser]
I'm trying to understand flexigrid and I have a question. Why are my columns not sorting?

Code is:

<html>
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<title>Flex Text</title>
<link rel="stylesheet" href="css/flexigrid.css" type="text/css" />




$(document).ready(function() {

$('.flexme').flexigrid();

}); //close $(


</head>
<body>
Flex Test<br />

<table class="flexme">
<thead>
<tr>
<th width="100">Time</th>
<th width="100">Class Name</th>
<th width="100">Instructor</th>
<th width="100">Day Offered</th>
</tr>
</thead>
<tbody>
<tr>
<td>7:30 am</td>
<td>Aerobics</td>
<td>John</td>
<td>Tuesday</td>
</tr>
<tr>
<td>9:00 am</td>
<td>Fit over 50</td>
<td>Karin</td>
<td>Monday</td>
</tr>
<tr>
<td>8:00 am</td>
<td>Weights</td>
<td>Jim</td>
<td>Monday</td>
</tr>
<tr>
<td>11:00 am</td>
<td>Weights</td>
<td>Jim</td>
<td>Thursday</td>
</tr>
<tr>
<td>5:00 pm</td>
<td>Aerobics</td>
<td>Karin</td>
<td>Monday</td>
</tr>
</tbody>
</table>

&lt;/body&gt;
&lt;/html&gt;
#2

[eluser]Pascal Kriete[/eluser]
I've never used it, but ... you're not including a js file.

edit: use [ code ] tags to make it easier to read your posts.
#3

[eluser]mjhan300[/eluser]
Here is my index file. The table shows up fine and is formatted as on the flexigrid home site. Looks great, columns can be moved, etc... When I click on the column headings, nothing happens, rows are not resorted. From my last post, I have removed the table headings from the <table></tables> tags and put them in use the colModel method as shown in other examples.

Code:
<!DOCTYPE html PUBLIC "-//W3C//  DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"&gt;
&lt;title&gt;Flex Text&lt;/title&gt;
&lt;link rel="stylesheet" href="css/flexigrid.css" type="text/css" /&gt;




    $(document).ready(function() {

       $('.flexme').flexigrid(
       {
            colModel: [
                {display: 'Time', name: 'time', width: 100, sortable: true, align: 'center'},
                {display: 'Class Name', name: 'class_name', width: 100, sortable: true, align: 'left'},
                {display: 'Instructor', name: 'instructor', width: 100, sortable: true, align: 'left'},
                {display: 'Day Offered', name: 'day_offered', width: 100, sortable: true, align: 'left'}
            ],
            title: 'Monday',
       });

     }); //close $(


&lt;/head&gt;
&lt;body&gt;
Flex Test<br />

<div id="monday">
<table class="flexme" width="450">
    <tbody>
        <tr>
            <td>7:30 am</td>
            <td>Aerobics</td>
            <td>John</td>
            <td>Tuesday</td>
        </tr>
        <tr>
            <td>9:00 am</td>
            <td>Fit over 50</td>
            <td>Karin</td>
            <td>Monday</td>
        </tr>
        <tr>
            <td>8:00 am</td>
            <td>Weights</td>
            <td>Jim</td>
            <td>Monday</td>
        </tr>    
        <tr>
            <td>11:00 am</td>
            <td>Weights</td>
            <td>Jim</td>
            <td>Thursday</td>
        </tr>    
        <tr>
            <td>5:00 pm</td>
            <td>Aerobics</td>
            <td>Karin</td>
            <td>Monday</td>
        </tr>    
    </tbody>
</table>
</div>

&lt;/body&gt;
&lt;/html&gt;
#4

[eluser]Pascal Kriete[/eluser]
Ok, this could be a forum xss thing, but in your head you don't have the flexigrid script. You're using functions that aren't defined.

Code:
&lt;script src="whatever.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
#5

[eluser]mjhan300[/eluser]
The javascript src statements are stripped out when I post. I'll try to attach a png file of the top so you can see the js files are being loaded. Again, the only thing I cna't do is click on the heading and have the rows sort themselves. The css looks good, I can drag columns to other positions, I just can't sort??? I am very confused about this.
#6

[eluser]Pascal Kriete[/eluser]
Ok, after a bit of code browsing, I believe I've found the answer. It does not natively work with local data. The sort function does an ajax call to rebuild the table.

There is a function call in place (line 536) to sort locally. Only problem is that the function doesn't exist.
#7

[eluser]Hyra[/eluser]
Anyone found a sollution for the non-sorting headers?

I have installed all the FlexiGrid stuff, got it working with a custom ajax file, the table shows up nicely, but the columsn on't sort.

I don't think it has to do with local data (unless i don't get the remark) because it's working on a real url, with a real ajax (json type) file, and should .. work?




Theme © iAndrew 2016 - Forum software by © MyBB