gdepourtales / ng-cells

AngularJS Table directive that draws a table of data with different features
http://gdepourtales.github.io/ng-cells/
Other
77 stars 17 forks source link

checkboxes in cells #13

Closed shammai closed 10 years ago

shammai commented 10 years ago

I am using the custom template directive to include a template into each cell. The template has a checkbox with a custom directive. When I check the checkbox, it fires an event which tells me the row/col of the cell containing the checkbox.

However, when I scroll down, the checkbox in the visible cell remains checked even though the table should have scrolled the checked checkbox out of view.

Why do you think this might be happening?

kayhadrin commented 10 years ago

Hi Shammai,

The way this plugin works is by changing the contents of each cell as you scroll, but it does not actually scroll the table - that's why you don't see it scrolling smoothly. So when you are scrolling and looking at the checkboxes, they are just being regenerated as you go.

I think what you would need is an ng-model to associate a value from the data array to each checkbox. Then, when a checkbox is clicked or not, it'll change the value of the corresponding data array.

Does that make sense?

On 10 July 2014 22:54, shammai notifications@github.com wrote:

I am using the custom template directive to include a template into each cell. The template has a checkbox with a custom directive. When I check the checkbox, it fires an event which tells me the row/col of the cell containing the checkbox.

However, when I scroll down, the checkbox in the visible cell remains checked even though the table should have scrolled the checked checkbox out of view.

Why do you think this might be happening?

— Reply to this email directly or view it on GitHub https://github.com/gdepourtales/ng-cells/issues/13.

shammai commented 10 years ago

Thanks for the response. How can I reference the corresponding cell in the data array in my ng-model ? On Jul 10, 2014 4:55 PM, "David" notifications@github.com wrote:

Hi Shammai,

The way this plugin works is by changing the contents of each cell as you scroll, but it does not actually scroll the table - that's why you don't see it scrolling smoothly. So when you are scrolling and looking at the checkboxes, they are just being regenerated as you go.

I think what you would need is an ng-model to associate a value from the data array to each checkbox. Then, when a checkbox is clicked or not, it'll change the value of the corresponding data array.

Does that make sense?

On 10 July 2014 22:54, shammai notifications@github.com wrote:

I am using the custom template directive to include a template into each cell. The template has a checkbox with a custom directive. When I check the checkbox, it fires an event which tells me the row/col of the cell containing the checkbox.

However, when I scroll down, the checkbox in the visible cell remains checked even though the table should have scrolled the checked checkbox out of view.

Why do you think this might be happening?

— Reply to this email directly or view it on GitHub https://github.com/gdepourtales/ng-cells/issues/13.

— Reply to this email directly or view it on GitHub https://github.com/gdepourtales/ng-cells/issues/13#issuecomment-48607183 .

kayhadrin commented 10 years ago

The README provides an example on how to link to the data array from the custom cell template.

See below:

Note: The cell value is stored in scopeExtension.rawCellData and can be accessed in the Angular template as follow: {{scopeExtension.rawCellData.data}}. See test case ./test/custom-cell-template.html https://github.com/gdepourtales/ng-cells/blob/master/test/custom-cell-template.html for a full example.

In other words, the custom cell template can refer to the value of the current cell from scopeExtension.rawCellData.data.

On 11 July 2014 01:04, shammai notifications@github.com wrote:

Thanks for the response. How can I reference the corresponding cell in the data array in my ng-model ? On Jul 10, 2014 4:55 PM, "David" notifications@github.com wrote:

Hi Shammai,

The way this plugin works is by changing the contents of each cell as you scroll, but it does not actually scroll the table - that's why you don't see it scrolling smoothly. So when you are scrolling and looking at the checkboxes, they are just being regenerated as you go.

I think what you would need is an ng-model to associate a value from the data array to each checkbox. Then, when a checkbox is clicked or not, it'll change the value of the corresponding data array.

Does that make sense?

On 10 July 2014 22:54, shammai notifications@github.com wrote:

I am using the custom template directive to include a template into each cell. The template has a checkbox with a custom directive. When I check the checkbox, it fires an event which tells me the row/col of the cell containing the checkbox.

However, when I scroll down, the checkbox in the visible cell remains checked even though the table should have scrolled the checked checkbox out of view.

Why do you think this might be happening?

— Reply to this email directly or view it on GitHub https://github.com/gdepourtales/ng-cells/issues/13.

— Reply to this email directly or view it on GitHub < https://github.com/gdepourtales/ng-cells/issues/13#issuecomment-48607183> .

— Reply to this email directly or view it on GitHub https://github.com/gdepourtales/ng-cells/issues/13#issuecomment-48616970 .

shammai commented 10 years ago

I used the scopeExtension.rawCellData.data and it returned the value but since that variable is re-created each time I scrolled it didn't save the state.

I then modified the data variable directly and it seems to work now.

Thanks for your help.

On Thu, Jul 10, 2014 at 11:12 AM, David notifications@github.com wrote:

The README provides an example on how to link to the data array from the custom cell template.

See below:

Note: The cell value is stored in scopeExtension.rawCellData and can be accessed in the Angular template as follow: {{scopeExtension.rawCellData.data}}. See test case ./test/custom-cell-template.html < https://github.com/gdepourtales/ng-cells/blob/master/test/custom-cell-template.html>

for a full example.

In other words, the custom cell template can refer to the value of the current cell from scopeExtension.rawCellData.data.

On 11 July 2014 01:04, shammai notifications@github.com wrote:

Thanks for the response. How can I reference the corresponding cell in the data array in my ng-model ? On Jul 10, 2014 4:55 PM, "David" notifications@github.com wrote:

Hi Shammai,

The way this plugin works is by changing the contents of each cell as you scroll, but it does not actually scroll the table - that's why you don't see it scrolling smoothly. So when you are scrolling and looking at the checkboxes, they are just being regenerated as you go.

I think what you would need is an ng-model to associate a value from the data array to each checkbox. Then, when a checkbox is clicked or not, it'll change the value of the corresponding data array.

Does that make sense?

On 10 July 2014 22:54, shammai notifications@github.com wrote:

I am using the custom template directive to include a template into each cell. The template has a checkbox with a custom directive. When I check the checkbox, it fires an event which tells me the row/col of the cell containing the checkbox.

However, when I scroll down, the checkbox in the visible cell remains checked even though the table should have scrolled the checked checkbox out of view.

Why do you think this might be happening?

— Reply to this email directly or view it on GitHub https://github.com/gdepourtales/ng-cells/issues/13.

— Reply to this email directly or view it on GitHub < https://github.com/gdepourtales/ng-cells/issues/13#issuecomment-48607183>

.

— Reply to this email directly or view it on GitHub < https://github.com/gdepourtales/ng-cells/issues/13#issuecomment-48616970> .

— Reply to this email directly or view it on GitHub https://github.com/gdepourtales/ng-cells/issues/13#issuecomment-48618063 .