hkalbertl / jquery.appendGrid

The dynamic table input JavaScript plugin
https://appendgrid.azurewebsites.net
MIT License
148 stars 76 forks source link

Cannot get values on multiple grid #122

Closed richb201 closed 5 years ago

richb201 commented 6 years ago

I am having an issue with Custom type. I am using the code from the Custom Type example. The problem is when I click fast on the up or down on the spinner control, I get an error popup "Cannot get values on multiple grid". When I click slowly there is no problem. Here is the code I am using: $('#btnGetValue').button().click(function () { // Get the row count var rowCount = $('#tblAppendGridSurvey').appendGrid('getRowCount'); // Check the number of row in grid if (rowCount <= 1) { alert('Warning: Row 2 is not found'); } else { // Row index is start from 0. So, index=2 means the second row alert($('#tblAppendGridSurvey').appendGrid('getCtrlValue', 'Perc_time', 1)); } });

I have no idea where that error is coming from.

I am also not seeing the up or down arrows as you can see on these spinners. capture

hkalbertl commented 6 years ago

Hi richb201,

The "Cannot get values on multiple grid" message will be displayed when there are multiple table elements returned by jQuery. I can see your are using ID as selector so it should not happened.

After checking the source code, I guess one of the possibility to trigger this message is $('#tblAppendGridSurvey') cannot be selected by jQuery. For example, it is removed from DOM.

Alternatively, it may be a good choice to use "change" instead of "spin". I guess it will solve the time issue since "change" event will trigger one time only but "spin" will be triggered multiple time as user clicked on the up/down button.

For the missing up/down arrows, it may due to incorrect image path or CSS classes overridden by other frameworks. You may put a testing input element on the same page and initialize it as Spinner to check the arrows are there or not.

Hope it can help. Thanks!