As the title states I was wondering how i could perform the task of selecting a whole row/column of checkboxes using javascript as i have already done it with a foreach but that takes 3 seconds i wish that i can make this less.
1 2 3 4 5 select start end
1 Button
2
3
4
5
select
Im not sure how to depict it exactly i hope that this can better explain.
You could use css classes to designate the rows and columns for each checkbox, and then use jQuery to get the row or column of interest, like in this fiddle.
In the example, $('.r2') gets all checkboxes with the class 'r2' (ie., in row 2) ... change it to $('.c3') to get all in column 3.
Here is an example of creating a button to check a row or column.
UPDATE: Here is a more dynamic example
check out jQuery's .each function it would make that task piece of cake :)
Let me know if you need assistnace with it.
Related
I've to create a table with a row of input boxes.
The values entered in will then be multiplied by script and the answer placed in the last input box, the row total, if you will.
There is a button above the table to add another row.
Each time a row is added, the same input boxes need to appear, and the same 'row script' to calculate the row total.
Once a particular row has been added/updated, and it's row total calculated, a final number needs to be found, which is essentially the total of the row totals. Let's call it the column total.
My skills aren't super high, am learning as I go, especially from the decent responses this site seems to attract. One hopes this is at least understandable....
I've managed to get row to be added by a button using table.insertrow, and the scripts for doing the math are no problem. I have also managed to use a simple loop to create the dynamic variable names for each input box; named the same and numbered by row.
Where I'm stuck is generating the scripts to totalise a line and then another tot totalise the table, as the script needs to factor in how many rows there are, and I can't see how to write this except using Eval() (so far..).
I've also experimented a little with this and each but just got bogged down and could no longer see the logical flow.
What I've written to date is now just a mess.
Instead of posting code for comment/fix, I seek to better understand which way to address the problem using Javascript if at all possible, hopefully without using Eval().
Any suggestions would be welcomed by this brain-dead, gone bleary, wishing he hadn't started, noob.
UPDATE: Have seen a lot of ways to use JQuery, but it's not for me at the moment.
perhaps phrased differently - how in javascript would you loop through a table column, adding up all of the cell contents (numbers) in that column, please. I can't seem to figure out how to use Each as the variable names are different (numbered) per row.
Something like this:
var tr = document.createElement("<tr>");
var td = document.createElement("<td>");
tr.appendChild(td);
You have to create table row, fill it with cells, cells with buttons and so on. As result you will have table row variable which you can insert every time your button clicked.
I am very new to programming but have come across a situation in my work where I believe I need to use some javascript to make my survey manageable for the participant. The client wants to use Qualtrics as a scheduling system. Faculty identify time slots that they are available and the survey would start by hiding the ones that they will not be available for. Then dynamically hides buttons as the quotas fill for a given time slot.
My matrix table is 10 columns x 15 rows to accommodate all the times and days. I'm trying to reuse snips of codes that I have found online and so far have gotten to:
Qualtrics.SurveyEngine.addOnload(function()
{
$("QR~QID14~1~4").up().hide();
});
This is hiding a choice, but instead of row 1 column 4 it is hiding row 1 column 15 (whose inspect element is QR~QID14~1~10). Whatever I change my column number to (4 in the example) it is always hiding the check box in the last column. I don't understand what I am doing wrong. So I've gone into my results and realize it is hiding the correct button but the rest of the buttons are shifting left so it appears that the last button is hidden.
Once I get it to hide the correct column I want to add conditions to my code that will hide it based on the value of a quota, which I believe would look like:
Qualtrics.SurveyEngine.addOnload(function()
{
if ('${qo://QUOTAID/QuotaCount}' > 0) $("QR~QID14~1~4").up().hide();
});
Where I would find the QUOTAID via Qualtric's piped text option
I know I can format this as a list but there are too many options for some faculty to make that look right.
You want to hide the contents of the table cell, not the cell itself.
Qualtrics.SurveyEngine.addOnload(function() {
$('QR~QID14~1~4').up('td').childElements().invoke('hide');
});
I'm trying to work out how you can filter a v-for list using checkbox model array where you have multiple checkboxes ticked. Other examples I have found all do the same as my example here - just filter one checkbox at a time. Here is a simple demo of what I have so far - https://jsbin.com/fuzuzucike/1/edit?html,js,console,output as you can checkboxes 1-3 and a list of names.
If you click 1 it filters the name with id1 but then when you click 2 (with 1 still selected) no names appear. I would want names with ids 1 and 2 to show in this case. Am I missing something simple here or is it a case of having to create a custom filter to handle this functionality?
Many thanks.
Filters are deprecated, use computed properties:
https://jsbin.com/jofediqifi/1/edit?html,js,console,output
i have a scenario in JSP where i have to make a combo with a list containing 10 items say 1,2,3.... 10. now i select a combo. I also need to provide an add button that will add another combo with same elements except the one being selected in previous combo.
eg- if 1st combo selected value is 1 then in the next combo i'll have the list as 2,3,4.....10 i.e, having 9 elements and so on. the user can add 10 combos like this, each combo having the items that haven't been previously selected.
can anyone help me with this???
thanks in advance :) !!!
just to clear things out, your scenario is that you have 10 combo boxes that contain values from 1 to 10... i suggest you can use a case statement, or multiple if statements, you can use javascript for that...
I have been looking around at several Data Grids for JQuery UI.
I have found several such as:
* Flexigrid: http://flexigrid.info/
* jQuery Grid: http://www.trirand.com/blog/
* jqGridView: http://plugins.jquery.com/project/jqGridView
* Ingrid: http://reconstrukt.com/ingrid/
* SlickGrid http://github.com/mleibman/SlickGrid
However, what I need to do is when a record is clicked, expand the record into a sort of in-line form for the user to enter information. The amount of information in this form is much greater than the amount show in each gridview row.
For example you might see:
Header
Row 1
Row 2
Row 3
Row 4
Row 5
then click on Row 3 and see
Header
Row 1
Row 2
Form
Data input..... input and change data about the item that was in Row 3
Some more data input from input fields, selects etc.
End Form
Row4
Row5
Any ideas on how to use one of these data grid addons or another addon?
Or another way to go about doing this all together?
Thanks!
P.S. I would like it to look as professional as possible :)
Take a look at http://jeasyui.com
They have, buried deep within the demos, an example of what you describe. I could not find it on their website, but I have implemented an in table edit (that expands to a larger form just below the table item).