Hi,
I have a requirement whereby I need to limit the number of rows that can have a grid column checked in a grid. My grid is populated with a list of domains (e.g. 10 domains) and our users will be limited to a certain number of domains (e.g. 5) that they can have "active" (indicated by checking the row) at any given time. Can you tell me how I might be able to achieve limiting the number of rows that can be checked? I'm thinking that I'll need to apply an onclick handler to the checkboxes that will verify the number of checked rows and if it exceeds the limit, return false and display a validation message.
I've attached a previous sample related to another ticket. If possible could you amend this code to only allow a maximum of 250 rows to be checked at any time?
Many thanks,
Rick
Hello Rick,
Please feel free to contact me if you need any further assistance with this matter.
Thank you for your updates.
I investigated your code and I modified the sample according to your requirement. What I did is to set the "saveDomain" button`s disabled property initially to false and comment the code in the editRowEnded event. This way only the code in the summariesCalculated event is going to be responsible for the disabling the button. Every time a row is edited this event is going to be fired and based on the trueValues value the button is going to be enabled or respectively disabled.
I am attaching the modified sample for your reference. Please run this application on your side and let me know whether it helps you achieve your requirement. If this is not an accurate demonstration of what you are trying to achieve feel free to get back to me with more clarifications and comments.
I hope you find my suggestion helpful.
Looking forward to hearing from you.
Hi Vasya,
I have made progress on this and hopefully have simplified the issue. Please run the attached sample.
I need to be able to disable the save button if a certain number of "checked" rows has been exceeded. For the purposes of this example I have set an arbitrary limit of 242.
Step to illustrate my issue:
1) Note the number of checked rows is 239 when the sample opens.2) Check an unchecked row and click done (the save button becomes enabled as it should)3) do this again for 2 more rows.
When the limit is reached the "summariesCalculated" function disables the save button as it should, but then the "iggridupdatingeditrowended" function fires and re-enables the save button.
Can you show me how I can enable the save button when rows are edited however DISABLE the save button if too many rows have been checked?
An alternate solution would be to prevent or revert the checked status of any checked row that exceeds the limit (and if this is the only transaction, prevent the save button from enabling).
Many Thanks,Rick
Thank you for posting in our community.
I am currently looking into this matter for you. I will keep you posted on my progress and I will get back to you soon with more information or questions for you.
Please feel free to continue sending updates to this case any time.