in Education by
I need to show a details view based on a selected row in a table. I would like to show which row is currently selected in the table. Is it possible to do this with the 'style' binding? I've created a JSFidle with some code illustrating the idea...or lack of, since it currently all rows change color on row click. Here's the code:
Name Sales Price
${name} ${sales} ${price} And this is the Javascript: var viewModel = { items: ko.observableArray([ { name: "Well-Travelled Kitten", sales: 352, price: 75.95 }, { name: "Speedy Coyote", sales: 89, price: 190.00 }, { name: "Furious Lizard", sales: 152, price: 25.00 }, { name: "Indifferent Monkey", sales: 1, price: 99.95 }, { name: "Brooding Dragon", sales: 0, price: 6350 }, { name: "Ingenious Tadpole", sales: 39450, price: 0.35 }, { name: "Optimistic Snail", sales: 420, price: 1.50 } ]) }; So I think I need a reference to the current row, or adding a style attribute to my item and then bind to this, and then change in the click event. Any ideas? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You'll need to bind a click event to each row of the table. Once a row is clicked. then in the event handler you can change the color of the selected row + you can show the new details something like this > http://jsfiddle.net/wrzFx/11/

Related questions

0 votes
    I need to show a details view based on a selected row in a table. I would like to show which ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I'm looking to update a site for some friends with a pretty simple request (to change the time on each slide ... and the .php from the template that populates the slideshow:...
asked May 14, 2022 in Education by JackTerrance
0 votes
    How do you set the property of a Div for "-ms-transform" in JavaScript? I want to rotate a DIV ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    How do you set the property of a Div for "-ms-transform" in JavaScript? I want to rotate a DIV ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    Matrices can be created by row-binding with the help of the following function. (a) rjoin() (b) rbind() ... Started of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    When modifying a table style in Excel 2013, the maximum stripe size is 5. Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    The _________ is a necessary index in a long document * a.Template b.Table of content c.style d.mail merge Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
0 votes
    This is the example table that I want to do From the 'Yellow' highlight (row & column) color. I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 29, 2022 in Education by JackTerrance
0 votes
    Which of the below does the task of binding the parameters passed to the HTTP method to HTTP Header while using ... ? 1. @PathParam 2. @QueryParam 3. @HeaderParam 4. @PathVariable...
asked Jun 24, 2021 in Technology by JackTerrance
0 votes
    I want to make a blackberry button with images, the one image should be shown when focused and another ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 25, 2022 in Education by JackTerrance
0 votes
    How can set row number for each table row created by dir-paginate angularJs. I use two way code ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 14, 2022 in Education by JackTerrance
0 votes
    I have a mat-table with a component app-order-statuses on every row. the component calls the statuses ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I have an HTML table with a search field to filter the result by Name. And another field to show ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 22, 2022 in Education by JackTerrance
0 votes
    I have a document with many similar tables. I thought it is possible to set this table cols and ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    write the code to make 2×2 table (means two row and two columns) in html Select the correct answer from above options...
asked Nov 28, 2021 in Education by JackTerrance
...