Categories | Question details Back To List | ||||||||
DHTML Grid (pro edition) - FilterBy. Error on trying to use FilterBy "_Locator is null" 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: <script src=".../dhtml/grid/codebase/dhtmlxcommon.js"></script> <script src=".../dhtml/grid/codebase/dhtmlxcommon_debug.js"></script> <script src=".../dhtml/grid/codebase/dhtmlxgrid.js"></script> <script src=".../dhtml/grid/codebase/dhtmlxgridcell.js"></script> <script src=".../dhtml/grid/codebase/ext/dhtmlxgrid_filter.js"></script> I'm using IE7. Thanks for your advise, Regards Answer posted by Support on Oct 09, 2008 02:12 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. Answer posted by Sunchaser on Oct 09, 2008 02:33 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'); Regards,
Answer posted by Support on Oct 09, 2008 03:15 >>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"); http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Loading_data_in_grid.html#grid_art_loadingdata Attachments (1)
Answer posted by Sunchaser on Oct 09, 2008 08:42 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. Answer posted by Support on Oct 09, 2008 09:24 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. Answer posted by Sunchaser on Oct 09, 2008 09:58 Hi, Ok, that was it ... it seems so simple now; sorry. So, everything works fine now. Thanks. |