Dojo enhancedgrid sorting problem - dojo

I am using Dojo enhancedGrid (1.6) with indirectSelection plugin to generate checkboxes. I am having an issue with row selection and sorting.
Here is how to recreate the problem:
Check the checkboxes of the first 2 rows
Sort the grid by clicking on a column
The sort order of the rows changes, but the first 2 rows are still checked, the checkmark doesn't move with the rows.
This issue is present in both dataGrid and enhancedGrid, even on the Dojo example page.
http://dojotoolkit.org/reference-guide/dojox/grid/DataGrid.html
http://dojotoolkit.org/reference-guide/dojox/grid/EnhancedGrid.html
Is this a bug or is there a way to make the checkbox move with the row when sorting?

Yes,it really is.
I'm using dojo 1.7.1 release , and it still has this problem
what's more , when use
grid.rowSelectCell.setDisabled(0, true),
and then use
dijit.byId("dataGrid").rowSelectCell.toggleAllSelection(true);
the disabled checkboxes will still be selected.
badly, use
gridDomNode.selection.getSelected();
will still select the rows with disabled checkboxes

Hope this still helps.
I had the same issue, and found out it is already solved and patched... (at least from dojo version 1.6)
In short, the only thig you need to do is this.
[in your EnhancedGrid] set 'keepSelection' attribute to true,
e.g.
<div dojoType="dojox.grid.EnhancedGrid" keepSelection = true .../>
also, note that there is a precondition: Identifier(id) is required for store, as id is used for differentiating row items
thats it! now any sorting, filtering or pagination actions in the grid will preserve the selections!
More info here:
http://bugs.dojotoolkit.org/ticket/10855
Note: I'm using dojo version 1.6 and the patch mentioned in there is ALREADY applied to the dojo files, so you DO NOT NEED to apply such patch, just add the attribute to the grid, (and ensure your store is identified by the id.)

Related

Hide columns kipping data

My problem is the next:
I have a table in which I store information, by clicking on a row there will be a window in which I show that information in a certain format.
The problem I have when I try to make the table responsive because when trying to see it on small devices I have to do side scroll. I tried to hide columns with "display: hidden" but the data I can not retrieve, beacuse it not exists.
How can i do this?
Do yourself a favor - do not reinvent the wheel and use a specialized library, for example Datatables. At the very least, take a look at how datatables makes the table responsive.
You have not mentioned it, so I assume you are ok using jQuery, Bootstrap 3 or 4, Semantic UI or Foundation. For React / Angular there maybe other options.

How to check a dijit checkbox with javascript

I am working a very old codebase. It is using an old version of dijit, so I am having a hard time finding out how to do what I need to do.
There is a dijitcheckbox on a modal, it uses aria-pressed instead of checked, I need to check this box when a user selects a value elsewhere, but I can't get the box to check.
depends a bit on how old the dojo version is....
usually you can do something like
var w = dijit.byId(myWidgetId);
// or var w = dijit.byNode(checkboxDomNode);
w.set('checked', true);
for dojo 1.3 you need to use more specific functions:
w.setChecked(true)
the aria-pressed should be an additional attribute for screenreader, there will be a hidden "real" checkbox that is checked.
btw., the dojo api documentation even has entries for v1.3: http://dojotoolkit.org/api/1.3/dijit/form/CheckBox

Why does the "columnToggle"-Button animation does not change?

in my table I show/hide columns based on their class attribute. Everything works fine except that that the animation of the "columnToggle"-Button does not change. Therefor it is hard to see which groups have been selected.
Here is a test case on Datatables live with the same behavior : DataTables Live Example
What am I missing? Thanks for your help.
sanJo
It is a bug in the current version of Datatables. The "active" argument is not set properly. My workaround was to toggle the "active" argument with jquery toggleClass function.

How to set the default amount of rows in datatables plugin?

Does anyone know the Yet Another DataTables Column Filter (yadcf) js plugin ?
It doesn't have much documentation and I can't figure out how to set the default number of rows to display (it shows 10 rows as default and I want at least 50).
Quick answer: "pageLength": 50 (for 1.10+) or "iDisplayLength": 50 (for 1.9-)
Long one:
You need to distinguish between the datatables plugin and yadcf plugin
The sole purpose of yadcf it to allow the user the ability to easily add various types of filters to the datatables table
This jQuery plug-in allows the user to easily add filter components to table columns, the plug-in works on top of the DataTables jQuery plug-in.
So your current question is not related to the yadcf plugin,
But if you look at the yadcf showcase you can spot that in on of its pages it demonstrate the use of the iDisplayLength attribute (which is the one you need your case)
Look at the page Yet Another DataTables Column Filter - DOM source example, scroll till you see the code snippet used on that page , notice the: "iDisplayLength": 25
p.s I'm the author of yadcf

change cell styling in KendoGrid

Just discovered the KendoGrid and was trying to change the style of an individual column(cell) after changing another cellvalue. For example I have a grid with a shipname and shipcity column. Suppose I have a business rule that says :
'Make shipcity cell value disabled when the shipname on the same row has the same value'
I found this sample which uses the blur event which I probably use, what would be a good way of implementing this rule?
Also nice to know your opinion in relation to asp.net mvc integration.
jsfiddle link:http://jsfiddle.net/dingen2010/begjT/1/
Updated the link:
You can try the updated fiddle example here
Basically conditional editor templates are not supported out of the box. You have two options.
Either use the edit event of the Grid find the editor inside e.containder and disable it the way it needs to be (if using Kendo widget use the enable(false) method, or add the readonly attribute if regular input).
The other options is to define custom editor like demonstrated in this JsBin example.