This topic is locked

Javascript on List Page

5/22/2017 12:19:00 PM
ASPRunner.NET General questions
jadach authorDevClub member

Here is what I would like to do, but cannot figure it out.
On my list page all records have the select checkbox to the left. Each row has a dollar amount as part of the record.
I have a custom button to do something on selected records which works fine.
Here's the part I cannot figure out:
I would like to populate a custom label or code snippet above the grid on the list page that sums the dollar amount of any and all checked records. It would also need to calculate if a record is deselected. Is this even possible?
Thanks for any thoughts or help.

A
Arkie 5/22/2017



Here is what I would like to do, but cannot figure it out.
On my list page all records have the select checkbox to the left. Each row has a dollar amount as part of the record.
I have a custom button to do something on selected records which works fine.
Here's the part I cannot figure out:
I would like to populate a custom label or code snippet above the grid on the list page that sums the dollar amount of any and all checked records. It would also need to calculate if a record is deselected. Is this even possible?
Thanks for any thoughts or help.


When I recently needed to have some items totaled on a list, I did it in SQL designer. It went sorta like this:

SELECT the column to be totaled

FROM the table it's in

WHERE a check mark is or ain't.

AS a total for the checked
select sum(price)

from detail

where checked = trueornot

as checkedtotal
Your app may be a bit more complicated than this, but I have found I can do an awful lot through SQL.

jadach authorDevClub member 5/22/2017

Thanks for that.
I wish I could do that. Unfortunately, my check boxes are not part of the data set.

I am referring the the check box you select as if you were going the export selected records. SO I assume java script must be in play here. I want the page to know when records are selected, then sum all selected records.

A
Arkie 5/23/2017



Thanks for that.
I wish I could do that. Unfortunately, my check boxes are not part of the data set.

I am referring the the check box you select as if you were going the export selected records. SO I assume java script must be in play here. I want the page to know when records are selected, then sum all selected records.


Nice idea and I'm interested in what you find. I see problems using the class for selected records.. i.e. what happens if you have a lot of records and some records are on two different pages? When you select records on page x and then jump to page y, the selections on page x are lost. Maybe there's a solution for that.
I like your idea but I think I would just add a field to the db or even create a related table of nothing more than a pointer to a chosen record. There might even be a reason to save a user's selection...?

~Joe

jadach authorDevClub member 5/23/2017

I agree with you. It is for a client. I personally would avoid for the reasons you stated. But, who knows, maybe some javascript guru can point me in the right direction. Maybe not even possible.