paulopmx / Flexigrid

Lightweight but rich data grid with resizable columns and a scrolling data to match the headers, plus an ability to connect to an xml/json based data source using Ajax to load the content.
689 stars 537 forks source link

a problem about single-selected #47

Open jftt opened 12 years ago

jftt commented 12 years ago

Hello, paulopmx Component flexgrid is very convenient. We are very grateful about it. We found a problem while using the component, if you don’t mind; we want to seek your advice about it. We want to set the grid only one line can be selected. In the component, in default, multi-line can be selected, and the selection of single line can be achieved through the set of the property of singleSelect. However after setting the property of singleSelect to be true, no line can be selected. So we analyzed the source code of the component. Below is the process of component (v1.1).

  1. Click a certain line, and have the background colored. L689:$(this).toggleClass('trSelected');
  2. If only one line can be selected, clear the background color of other lines on the same level. L691:$(this).siblings().removeClass('trSelected');
  3. Execute the toggleClass method again, the function of the method is: If there is a class, delete it. If there is not one, add one.. L692:$(this).toggleClass('trSelected');
  4. The operation in step 3 result in the deletion of the line’s background color. So, we want to know whether the process of L692 is unnecessary. Looking forward to your answer.
zulucoda commented 12 years ago

ya also have the same issue