Login Register

sort

sortField property in html for dojoGrid?

i'd like to do something like

<th field="budget" sortField="budgetValue" width="20%">Budget</th>
<th field="expenditures" sortField="expendituresValue" width="20%">Expenditures</th>

Custom Sorting in a Data Store

I've found from looking through the forums that the following code allows you to setup a custom comparator to a field within a data store.

test_store.comparatorMap = {};
   test_store.comparatorMap['fieldName'] = sorterFunction;

   function sorterFunction( fieldNameData1, fieldNameData2 )
   {
      console.info( fieldNameData1, fieldNameData2 );
   };

Sort is using wrong comparator

In my field definition, the field offset describing where the field's data is located in the data table is different from the index into the field array. For example

column_defs = [
{fieldname: 'MRLINEID', name: 'ID',  field: 4, compare: idCompare }, 
{fieldname: 'CHANGEDATE', name: "ChangeDate", field: 1, compare: sortNumber},
{fieldname: 'DESCRIPTION', name: "Description", field: 7, compare: descCompare}];
var model = new dojox.grid.data.Table(column_defs, data);
grid.setModel(model);

in this case,
data[row][4] is the MRLINEID data and

SOrting grid column data with custom content.

Hi All,
I am working with grid - ItemFileReadStore (Dojo 1.1.1). By default all columns of the grid are sortable...

However columns that use get and not field are not sortable. Thank you all in advance for your inputs.

var view0 =
{
cells:
[
[
                        {name: 'Roll',        field: 'roll'},
                        {name: 'Name',        field: 'name'},
                        {name: 'Marks',       field: 'marks'},
                        {name: 'Is Active?',  get: getIsActive}
]
]
};

In the above snippet Is Active column is NOT sortable...

Regards,
Yazad

Disable Sorting on specific column.

Hi All,
I would like to disable sorting on a specific column. Could someone shed come light on how this can be achieved?

Regards,
Yazad K

how to disable user (client) sort

Hi

Like in topic, i need to display sorted grid table, but disable sorting and ordering by users. Sorting list was easy:

function _grid_init(){
        grid.setSortIndex(0, true);
        grid.sort();
        grid.update();
    }

    dojo.addOnLoad(_grid_init);

But, i don't know how to disable sorting for users :/

<div id="grid" dojoType="dojox.Grid"  singleClickEdit="false" model="model"
            structure="gridLayout"
            jsId="grid"
            clientSort="false"
>

is not working :(

Any ideas?

Grid sorting problems when using dojox.data.QueryReadStore in 1.1.0 version

Hi,

When I tried to update my application from dojo 1.0.2 to dojo 1.1.0rc1 version i encountered a problem.

I am retrieving the grid data from a servlet using the dojox.data.QueryReadStore.
When I am trying to sort the table in the client side using clientSort=true all the grid data disappear and
I stay with an empty grid

The same code is working on dojo 1.0.2 version.

Here is the grid definition code:

Large ItemFileReadStore, sort totally confuzled!

I have a grid using an ItemFileReadStore (actually same thing happens with a QueryReadStore and doClientPaging=true) with a moderately large (600 record x 9 field) dataset.

Performance stinks with Firefox, and is decent with Microsoft Internet Explorer, but that's not the issue.

When I click on a column header to reverse sort, the grid seems to be quite "confused". Scrolling causes even more confusion.

(See next response - I've editing this after adding sequential numbers to the dataset to get a better picture of what's happening.)

Grid sort fails on columns containing empty cells

It seems that sorting on a column in a Grid does not work as I would expect when some of the cells in the column are empty. I have a Grid in which some of the fields are only populated for some rows. Sorting on columns with data in every row works fine, but when I sort on the columns with patchy data, the rows do get re-ordered, but in an apparently semi-random fashion, with the blank values scattered through the column, and even the rows with real values not ordered in any obvious way.

i) is this a known problem? (I searched but couldn't find anything.)

Suggestion: Allow to sub sort a column programmatically

It would be nice to have in the compare function a refernce to the row numbers.

Instead of:

model.fields.get(0).compare = function(a, b){
return (b > a ? 1 : (a == b ? 0 : -1));
}

Maybe something like:

model.fields.get(0).compare = function(a, b, aRow, bRow){
return (b > a ? 1 : (a == b ? { ... sub sort logic ... } : -1));
}

This way, when sorting by column 0 (for example) I could programmatically do a sub sort by any other column.

Syndicate content