Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
Bind both the table inside the Div using Knockoutjs
Murali krishna Ande
Jan 16 2014 8:54 AM
1.2k
Reply
Hi,
I have a requirement to show the employees department wise like below;
Department: Developers Count:3
EmpID
Name
Salary
Action
101
AAAAA
10000
some buttons
102
BBBBB
15000
103
CCCCC
10000
Department:Finance Count:2
EmpID
Name
Salary
Action
104
xxxxx
10000
some buttons
105
yyyyyy
15000
For the above requirement I designed my View like below
<div data-bind="foreach: Departments">
<span class="pull-left" data-bind="text: DeptName"></span>
<span class="pull-right" data-bind="text: Count"></span>
<table>
<thead>
<tr>
<th>EmpID</th>
<th>Name</th>
<th>Salary</th>
<th>Action</th>
</tr>
</thead>
<tbody data-bind="foreach: Employees">
<tr>
<td>
<span data-bind="text: EmpID"></span>
</td>
<td>
<span data-bind="text: Name"></span>
</td>
<td>
<span data-bind="text: Salary"></span>
</td>
<td>
<button type="submit" value="View"></button>
</td>
</tr>
</tbody>
</table>
</div>
Can somebody help with the knockout code. How to bind the data to Div and Table inside in it.
Thanks in Advance
Murali Krishna.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Difference between Client and Server side Java Script
add tolltip in html page