DHTML Grid (pro edition) - FilterBy. Error on trying to use

Hello,



I’ve just buy the DHX Grid pro, and I’m beginning with object.

I’m trying to use “filterBy” function, in a javascript function, and the error given is:

“_Locator is null or is not a object”



It is just a small test, with “static” values to see what filter do, something like:

“the_grid.filterBy(1, ‘A_Value’);”

So, nothing complex.



The references in the page are:













I’m using IE7.



Thanks for your advise,

Regards

Can you please provide full init code use in your test
Be sure that filterBy called after data loaded in grid ( the data loading is async process , so you need to use onXLE event or second parameter of loadXML )
Also, be sure that each row has unique ID , not unique or missed IDs may be the reason of the problem.


Hi,



THanks for yor answer.



The problem might be that the datas are loaded only by the function AddRow(…), for the moment. Could it be the reason of the error ?



The HTML / Javascript of the most important part of the page is created dynamically at the same time that were are retrieving datas from SQL on Oracle DB.



As I have a pro version, I can imagine changing a few things and load data in grid by creating a CSV string and using ‘loadCSVString(str)’ function, if it could solve the problem.



For the code before the “AddRow” section is:



 grid_t = new dhtmlXGridObject(‘grid_t’);
 grid_t.setImagePath("…/codebase/imgs/");
 grid_t.setHeader(“T, *, A, D”);
 grid_t.setInitWidths(“0,20,200,300”);
 grid_t.setColAlign(“left,left,left”);
 grid_t.setSkin(“light”);
 grid_t.setColSorting(“int,na,str,str”);
 grid_t.setColTypes(“ro,ch,ro,ro”);
 grid_t.attachEvent(“onCheckbox”,doOnCheck);
 grid_t.init();



Regards,




 

Could it be the reason of the error ?
It must work correctly, please check attached sample.

>>As I have a pro version, I can imagine changing a few things and load data in grid by creating a CSV
Technically standar edition has all necessary for such action
grid.parse(“csv string here”,“csv”);
dhtmlx.com/docs/products/dhtmlxG … oadingdata

1223548439.zip (98.2 KB)


Hi,



Thanks for the answer.



I took your code (init of a grid, addRow and then filter), and it works.



But whatever I do, filtering on my own grid is not working. I don’t see why.



The generated code for insertion of rows is (for example):



"addRow(grid_t.uid(), [1, 0, “a_value1”, “a_value2”], 1);



_locator is still considered as null or undefined.

Change your code to the
addRow(grid_t.uid(), [1, 0, “a_value1”, “a_value2”])

When you are using 1 as last parameter - you adding row to the position “1”, while row indexes started from “0”, as results you have grid filled with data from index 1, and not filled row at position 0, which will cause an issue.

When addRow used without last parameter - it will add row to the end of the grid.


Hi,



Ok, that was it … it seems so simple now; sorry.



So, everything works fine now.



Thanks.