jQuery UI Widgets › Forums › DataTable › Dynamic DataTable
Tagged: Cell, getselectedcells, grid, jqxgrid, mouseup, multiplecellsextended, selected, selectionmode
This topic contains 7 replies, has 2 voices, and was last updated by Dimitar 10 years, 1 month ago.
-
AuthorDynamic DataTable Posts
-
Hi,
i have a dynamic DataTable. I can set the Rows and Columns via InputField.
No i want to select the Rows dynamically.
When i choose the amount of selection, f.e 2 rows (via Combobox), i only want to select two rows.
Is this possible?Hello simcon94,
You just have to call the method selectRow as many times as the amount set in the combobox.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/OK.
Can i get the “getselectedcells” without a button click?
I wanted to know, how many cells i selected.
I have this mode:
.jqxGrid(“selectionmode”, “multiplecellsextended”);I wanna do something like this:
//CELLSELECT EVENT $("#matrix").bind("cellselect", function (event) { cells = $("#matrix").jqxGrid("getselectedcells"); var groupsSize = $("#Matrix_Groups").val(); if (cells.length === groupsSize) { console.log("READY"); } else if (cells.length > groupsSize) { $("#matrix").jqxGrid('clearselection'); } });
The console.log() fires every time, when the selction == groupSize.
I only want to have this condition, when my selection is finished(mouse event)Hi simcon94,
Are you referring to jqxDataTable or jqxGrid? These widgets, while similar in appearance, have different API.
As for your question – unfortunately, there is no event that fires after the last cell has been selected when selectionmode is “multiplecellsextended”. Maybe you will be able to create a custom mouseup binding which suits your purposes.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Sorry, have grid.
Do you have an example?$("#matrix").mouseup(function() { var groupsSize = $("#Matrix_Groups").val(); if (cells.length > groupsSize) { $("#matrix").jqxGrid('clearselection'); } else if (cells.length === groupsSize) { $("#popUpBit").jqxWindow('open'); }
I tried this way.
This is OK, when you selected the cell with CTRL and Mouse Click. But not, when you select the cell with mouse and pressed mouse button….$("#matrix").mouseup(function () { cells = $("#matrix").jqxGrid("getselectedcells"); console.log("Seleted Cells: " +cells.length); });
SELECTED CELLS IS ALWAYS 1….hmmmmmm
Hi simcon94,
Maybe you need to call the mouseup event handler code with some delay, e.g.:
$("#matrix").mouseup(function () { setTimeout(function () { cells = $("#matrix").jqxGrid("getselectedcells"); console.log("Seleted Cells: " + cells.length); }, 500); });
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.