Search Results

Search found 1047 results on 42 pages for 'th'.

Page 5/42 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Need help displaying a dynamic table

    - by Gideon
    I am designing a job rota planner for a company and need help displaying a dynamic table containing the staff details. I have the following tables in MySQL database: Staff, Event, and Job. The staff table holds staff details (staffed, name, address...etc), the Event table (eventide, eventName, Fromdate, Todate...etc) and the Job table holds (Jobid, Jobdate, Eventid(fk), Staffid (fk)). I need to dynamically display the available staff list from the staff table when the user selects the EVENT and the DATE (3 drop downs: date, month, and year) from a PHP form. I need to display staff members that have not been assigned work on the selected date by checking the Jobdate in the Job table. I have been at this for all day and can't get around it. I am still learning PHP and would surely appreciate any help I can get. My current code displays all staff members when an event is selected: if(isset($_POST['submit'])) { $eventId = $_POST['eventradio']; } $timePeriod = $_POST['timeperiod']; $Day = $_POST['day']; $Month = $_POST['month']; $Year = $_POST['year']; $dateValue = $Year."-".$Month."-".$Day; $selectedDate = date("Y-m-d", strtotime($dateValue)); //construct the available staff list if ($selectedDate) { $staffsql = "SELECT s.StaffId, s.LastName, s.FirstName FROM Staff s WHERE s.StaffId NOT IN (SELECT J.StaffId FROM Job J WHERE J.JobDate != ".$selectedDate.")"; $staffResult = mysql_query($staffsql) or die (mysql_error()); } if ($staffResult){ echo "<p><table cellspacing='1' cellpadding='3'>"; echo "<th colspan=6>List of Available Staff</th>"; echo "</tr><tr><th> Select</th><th>Id</th><th></th><th>Last Name </th><th></th><th>First Name </th></tr>"; while ($staffarray = mysql_fetch_array($staffResult)) { echo "<tr onMouseOver= this.bgColor = 'red' onMouseOut =this.bgColor = 'white' bgcolor= '#FFFFFF'> <td align=center><input type='checkbox' name='selectbox[]' id='selectbox[]' value=".$staffarray['StaffId']."> </td><td align=left>".$staffarray['StaffId']." </td><td>&nbsp&nbsp</td><td align=center>".$staffarray['LastName']." </td><td>&nbsp&nbsp</td><td align=center>".$staffarray['FirstName']." </td></tr>"; } echo "</table>"; } else { echo "<br> The Staff list can not be displayed!"; } echo "</td></tr>"; echo "<tr><td></td>"; echo "<td align=center><input type='submit' name='Submit' value='Assign Staff'>&nbsp&nbsp"; echo "<input type='reset' value='Start Over'>"; echo "</td></tr>"; echo "</table>";

    Read the article

  • get values from table as key value pairs with jquery

    - by liz
    I have a table: <table class="datatable" id="hosprates"> <caption> hospitalization rates test</caption> <thead> <tr> <th scope="col">Funding Source</th> <th scope="col">Alameda County</th> <th scope="col">California</th> </tr> </thead> <tbody> <tr> <th scope="row">Medi-Cal</th> <td>34.3</td> <td>32.3</td> </tr> <tr> <th scope="row">Private</th> <td>32.2</td> <td>34.2</td> </tr> <tr> <th scope="row">Other</th> <td>22.7</td> <td>21.7</td> </tr> </tbody> </table> i want to retrieve column 1 and column 2 values per row as pairs that end up looking like this [funding,number],[funding,number] i did this so far, but when i alert it, it only shows [object, object]... var myfunding = $('#hosprates tbody tr').each(function(){ var funding = new Object(); funding.name = $('#hosprates tbody tr td:nth-child(1)').map(function() { return $(this).text().match(/\S+/)[0]; }).get(); funding.value= $('#hosprates tbody tr td:nth-child(2)').map(function() { return $(this).text().match(/\S+/)[0]; }).get(); }); alert (myfunding);

    Read the article

  • show/hide html table columns using css

    - by Art Peterson
    I want to display a basic html table with controls to toggle showing/hiding of additional columns: <table id="mytable"> <tr> <th>Column 1</th> <th class="col1">1a</th> <th class="col1">1b</th> <th>Column 2</th> <th class="col2">2a</th> <th class="col2">2b</th> </tr> <tr> <td>100</td> <td class="col1">40</td> <td class="col1">60</td> <td>200</td> <td class="col2">110</td> <td class="col2">90</td> </tr> </table> So Column 1 and Column 2 will be the only columns displayed by default - but when you click on the Column 1 I want 1a and 1b to toggle, and same with Column 2 with 2a and 2b. I may end up with more columns and lots of rows - so any javascript looping approaches have been too slow to work with when I tested. The only approach that seems to be fast enough is to set up some css like this: table.hide1 .col1 { display: none; } table.hide2 .col2 { display: none; } table.hide3 .col3 { display: none; } table.show1 .col1 { display: table-cell; } table.show2 .col2 { display: table-cell; } table.show3 .col3 { display: table-cell; } And then set up onClick function calls on the table header cells that will trigger a toggle - and determine which css class to set "mytable" to that will create the toggle effect that I'm looking for. Is there an easy way to set this up so that the code can work for n # of columns?

    Read the article

  • Auto complete from database using CodeIgniter (Active Record)

    - by Ralph David Abernathy
    I have a form on my website in which one is able to submit a cat. The form contains inputs such as "Name" and "Gender", but I am just trying to get the auto completion to work with the "Name" field. Here is what my jquery looks like : $(document).ready(function() { $( "#tags" ).autocomplete({ source: '/Anish/auto_cat' }); }); Here is what my model looks like: public function auto_cat($search_term) { $this->db->like('name', $search_term); $response = $this->db->get('anish_cats')->result_array(); // var_dump($response);die; return $response; } } Here is my controller: public function auto_cat(){ $search_term = $this->input->get('term'); $cats = $this->Anish_m->auto_cat($search_term); } And here is my view: <head> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> </head> <h1>Anish's Page</h1> <form action="/Anish/create" method="POST"> <div class="ui-widget"> <label for="tags">Name</label><input id="tags" type="text" name="name"> </div> <div> <label>Age</label><input type="text" name="age"> </div> <div> <label>Gender</label><input type="text" name="gender"> </div> <div> <label>Species</label><input type="text" name="species"> </div> <div> <label>Eye Color</label><input type="text" name="eye_color"> </div> <div> <label>Color</label><input type="text" name="color"> </div> <div> <label>Description</label><input type="text" name="description"> </div> <div> <label>marital status</label><input type="text" name="marital_status"> </div> <br> <button type="submit" class="btn btn-block btn-primary span1">Add cat</button> </form> <br/><br/><br/><br/> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Name</th> <th>Gender</th> <th>Age</th> <th>Species</th> <th>Eye Color</th> <th>Color</th> <th>Description</th> <th>Marital Status</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php foreach ($cats as $cat):?> <tr> <td> <?php echo ($cat['name']);?><br/> </td> <td> <?php echo ($cat['gender']);?><br/> </td> <td> <?php echo ($cat['age']);?><br/> </td> <td> <?php echo ($cat['species']);?><br/> </td> <td> <?php echo ($cat['eye_color']);?><br/> </td> <td> <?php echo ($cat['color']);?><br/> </td> <td> <?php echo ($cat['description']);?><br/> </td> <td> <?php echo ($cat['marital_status']);?><br/> </td> <td> <form action="/Anish/edit" method="post"> <input type="hidden" value="<?php echo ($cat['id']);?>" name="Anish_id_edit"> <button class="btn btn-block btn-info">Edit</button> </form> </td> <td> <form action="/Anish/delete" method="post"> <input type="hidden" value="<?php echo ($cat['id']);?>" name="Anish_id"> <button class="btn btn-block btn-danger">Delete</button> </form> </td> </tr> <?php endforeach;?> </tbody> </table> I am stuck. In my console, I am able to see this output when I type the letter 'a' if I uncomment the var_dump in my model: array(4) { [0]=> array(9) { ["id"]=> string(2) "13" ["name"]=> string(5) "Anish" ["gender"]=> string(4) "Male" ["age"]=> string(2) "20" ["species"]=> string(3) "Cat" ["eye_color"]=> string(5) "Brown" ["color"]=> string(5) "Black" ["description"]=> string(7) "Awesome" ["marital_status"]=> string(1) "0" } [1]=> array(9) { ["id"]=> string(2) "16" ["name"]=> string(5) "Anish" ["gender"]=> string(2) "fe" ["age"]=> string(2) "23" ["species"]=> string(2) "fe" ["eye_color"]=> string(2) "fe" ["color"]=> string(2) "fe" ["description"]=> string(2) "fe" ["marital_status"]=> string(1) "1" } [2]=> array(9) { ["id"]=> string(2) "17" ["name"]=> string(1) "a" ["gender"]=> string(1) "a" ["age"]=> string(1) "4" ["species"]=> string(1) "a" ["eye_color"]=> string(1) "a" ["color"]=> string(1) "a" ["description"]=> string(1) "a" ["marital_status"]=> string(1) "0" } [3]=> array(9) { ["id"]=> string(2) "18" ["name"]=> string(4) "Matt" ["gender"]=> string(6) "Female" ["age"]=> string(2) "80" ["species"]=> string(6) "ferret" ["eye_color"]=> string(4) "blue" ["color"]=> string(4) "pink" ["description"]=> string(5) "Chill" ["marital_status"]=> string(1) "0" } }

    Read the article

  • How to solve this simple PHP forloop issue?

    - by Londonbroil Wellington
    Here is the content of my flat file database: Jacob | Little | 22 | Male | Web Developer * Adam | Johnson | 45 | Male | President * Here is my php code: <?php $fopen = fopen('db.txt', 'r'); if (!$fopen) { echo 'File not found'; } $fread = fread($fopen, filesize('db.txt')); $records = explode('|', $fread); ?> <table border="1" width="100%"> <tr> <thead> <th>First Name</th> <th>Last Name</th> <th>Age</th> <th>Sex</th> <th>Occupation</th> </thead> </tr> <?php $rows = explode('*', $fread); for($i = 0; $i < count($rows) - 1; $i++) { echo '<tr>'; echo '<td>'.$records[0].'</td>'; echo '<td>'.$records[1].'</td>'; echo '<td>'.$records[2].'</td>'; echo '<td>'.$records[3].'</td>'; echo '<td>'.$records[4].'</td>'; echo '</tr>'; } fclose($fopen); ?> </table> Problem is I am getting the output of the first record repeated twice instead of 2 records one for Jacob and one for Adam. How to fix this?

    Read the article

  • PHP HTML table is too wide

    - by typoknig
    I have a table that I cannot get to size correctly. The table populates with information from a database via a loop. Sometimes if the data is too long the table extends past where it should. When the data is that long I want the data to wrap in the cells so the table stays where it should. I have tried the normal table data but it isn't working. Any ideas? <?php echo "<table> <tr> <th>id</th> <th>700-number</th> <th>First name</th> <th>Last name</th> <th>Email</th> <th>Response</th> <th>Created On</th> </tr>"; $num = mysql_num_rows($result); for ($i = 0; $i < $num; $i++) { $row = mysql_fetch_array($result); $id = $row['id']; $school_id = $row['school_id']; $fname = $row['first_name']; $lname = $row['last_name']; $email = $row['email']; $attending = ($row['attending'] == 0) ? 'No' : 'Yes'; $date = $row['created_on']; $class = (($i % 2) == 0) ? "td2" : "td1"; echo "<tr>"; echo "<td class=" . $class . ">$id</td>"; echo "<td class=" . $class . ">$school_id</td>"; echo "<td class=" . $class . ">$fname</td>"; echo "<td class=" . $class . ">$lname</td>"; echo "<td class=" . $class . ">$email</td>"; echo "<td class=" . $class . ">$attending</td>"; echo "<td class=" . $class . ">$date</td>"; echo "</tr>"; } ?> </table>

    Read the article

  • How to do word wrapping.

    - by Talha Bin Shakir
    Hi, I have created a table in PHP but the cells size is not fixed it expends when the input is long. Here is the Code. echo "<div style=\"overflow-y: scroll; white-space: nowrap; height: 190px;\">\n"; echo "<table cellspacing=\"1\" cellpadding=\"1\" align=\"center\" width=\"100%\" id=\"clients\">\n"; echo "<tr bgcolor=\"2b2d5d\">\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">&nbsp;</th>\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Name</th>\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Address</th>\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Phone</th>\n"; echo "<th align=\"left\" style=\"color: FFFFFF; font-size: 12px; font-weight: normal; font-family: Arial; padding: 5\">Fax</th>\n"; I want to fixed the cells width please need help. Thanks

    Read the article

  • Javascript and VERY LONG string

    - by StealthRT
    Hey all, i am having problems with the below code: function showTableData() { var tableArray; var x = 0; var theHTML; for (i = 0; i < 7032; i++) { if (x = 0) { theHTML = '<tr>' + '<th scope="row" class="spec">' + partNum[i] + '</th>' + '<td>' + Msrp[i] + '</td>' + '<td>' + blah[i] + '</td>' + '<td>' + blahs[i] + '</td>' + '</tr>' + theHTML; x++; }else{ theHTML = '<tr>' + '<th scope="row" class="specalt">' + partNum[i] + '</th>' + '<td class="alt">' + Msrp[i] + '</td>' + '<td class="alt">' + blah[i] + '</td>' + '<td class="alt">' + blahs[i] + '</td>' + '</tr>' + theHTML; x--; } } theHTML = '<table id="mytable" cellspacing="0">' + '<tr>' + '<th scope="col" abbr="Configurations" class="nobg">Part Number</th>' + '<th scope="col" abbr="Dual 1.8">Msrp Price</th>' + '<th scope="col" abbr="Dual 2">blahs Price</th>' + '<th scope="col" abbr="Dual 2.5">Low Price</th>' + '</tr>' + theHTML + '</table>'; $('#example').append(theHTML); } </script> <div id="example"> </div> The problem being that the $('#example').append(theHTML); never executes (or shows on the page). I think its because the string is soooooo long! It has over 7,000 items in the array so im not sure if thats the reason or if its something else? Any help would be great! Thanks! David

    Read the article

  • optimizing the jquery in django

    - by sankar
    I have done the following code which actually dynamically generate the values in the third list box using ajax and jquery concepts. Thoug it works, i need to optimize it. Below is the code i am working on now. <html> <head> <title>Comparison based on ID Number</title> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> {% if form.errors %} <p style="color: red;"> Please correct the error{{ form.errors|pluralize }} below. </p> {% endif %} <form action="/idnumber/" method="post" align= "center">{% csrf_token %} <p>Select different id numbers and the name of the <b> Measurement Group </b>to start the comparison</p> <table align = "center"> <tr> <th><label for="id_criteria_1">Id Number 1:</label></th> <th> {{ form.idnumber_1 }} </th> </tr> <tr> <th><label for="id_criteria_2">Id Number 2:</label></th> <th> {{ form.idnumber_2 }} </th> </tr> <tr> <th><label for="group_name_list">Group Name:</label></th> <th><select name="group_name_list" id="id_group_name_list"> <option>Select</option> </select> </th> </tr> <script> $('#id_idnumber_2').change( function get_group_names() { var value1 = $('#id_idnumber_1').attr('value'); var value2 = $(this).attr('value'); alert(value1); alert(value2); var request = $.ajax({ url: "/getGroupnamesforIDnumber/", type: "GET", data: {idnumber_1 : value1,idnumber_2 : value2}, dataType: "json", success: function(data) { alert(data); var myselect = document.getElementById("group_name_list"); document.getElementById("group_name_list").options.length = 1; var length_of_data = data.length; alert(length_of_data); try{ for(var i = 0;i < length_of_data; i++) { myselect.add(new Option(data[i].group_name, "i"), myselect.options[i]) //add new option to beginning of "sample" } } catch(e){ //in IE, try the below version instead of add() for(var i = 0;i < length_of_data; i++) { myselect.add(new Option(data[i].group_name, data[i].group_name)) //add new option to end of "sample" } } } }); }); </script> <tr align = "center"><th><input type="submit" value="Submit"></th></tr> </table> </form> </body> </html> everything works fine but there is a little problem in my code. (ie) my ajax function calls only when there is a change in the select list 2 (ie) 'id_number_2'. I want to make it call in such a way that which ever select box, the third list box should be updated automatically. Can anyone please help me on this with a possible logical solution

    Read the article

  • Are table headers only for the top row in html?

    - by Bill Zimmerman
    Hi, I always see the th tag only used in the first row of the table. Is there some specific reason why it can't be used to create 'left' headers along the leftmost column. Is this bad form, or is this ok. Basically, a table with headings on the top row and the leftmost column, with the very top left square being empty. e.g. <table> <tr> <th/> <!--empty--> <th>Top 1</th> <th>Top 2</th></tr> <tr> <th>LeftHeader?</th> <td>data1</td> <td>data2</td></tr> </table>

    Read the article

  • php link to call another php page

    - by user2086894
    i have a php page which contain this field: Delete i want when i press on the Delete to call the delcat.php and send a categoryid which is in a field in the same table. any one can help me to reach this please? here my complete table code: <table border="0" align='center' class="styled-table"> <tr class="thh"> <th class="thh">Category Code</th> <th class="thh">Category Name </th> <th class="thh">Category IMage </th> <th class="thh">Edit</th> <th class="thh">Delete</th> </tr> <?php for ($counter = 0; $row = mysql_fetch_row ($resultSet); $counter++) { print ("<tr align='center' class='trh'>"); print ("<td align='center' class='tdh'>$row[0]</td>"); print ("<td align='center' class='tdh'>$row[1]</td>"); print ("<td align='center' class='tdh'><img src='$row[2]' width='50' height='50'></td>"); print ("<td align='center' class='tdh' width='50' align='center'><a href src='#'>Edit</a></td>"); print ("<td align='center' class='tdh' width='50' align='center'><a href src='delcat.php'>Delete</a></td>"); print("</tr>"); }

    Read the article

  • Send mail to multiple recipient

    - by Ahmad Maslan
    Hi, i have already research on using the mail() to send to multiple recipient's but i just cant get it to work. What im trying to do is, for every order that i have, order 1,2,3, each having their own email addresses, when i change their order status from pending to confirm, the mail() will use that id to refer to the db table and send the email of those 3 orders. But for my case, it mailed just the latest order which is order 3. This is the form that i use to change the order status. <form action="results-action" method="post" enctype="multipart/form-data"> <fieldset> <table id ="table_id" class="display"> <thead> <tr><td><h2>Pending Order</h2></td></tr> <tr> <th scope="col">Order ID</th> <th scope="col"> </th> <th scope="col">Name</th> <th scope="col">Address</th> <th scope="col">Product Name</th> <th scope="col">Produt Quantity</th> <th scope="col">Price</th> <th scope="col">Order status</th> </tr> </thead> <tbody> <?php while ($row = mysqli_fetch_array($result)) { ?> <tr> <td><input type="text" value='<?=$row['virtuemart_order_id']?>' name="orderid" id="virtuemart_order_id"></td> <td><input type="hidden" value='<?=$row['virtuemart_product_id']?>' name="productid" id="virtuemart_product_id"></td> <td><?=$row['first_name']?></td> <td><?=$row['address_1']?></td> <td><?=$row['order_item_name']?></td> <td><?=$row['product_quantity']?></td> <td><?=$row['product_final_price'] ?></td> <td><select name='change[<?=$row['virtuemart_order_id']?>]'> <option value='C'> Confirmed</option> <option value='X'> Cancelled</option></select></td> </tr> <?php } ?> </tbody> </table> </fieldset> <fieldset> <table> <tr> <td><input type="submit" value="Update status" name="update status"> </td> </tr> </table> </fieldset> </form> This is the php, using the order id from the form to select the email addresses. <?php $orderid = $_POST['orderid']; // build SQL statement to select email addresses $query3 = "SELECT email from ruj3d_virtuemart_order_userinfos where virtuemart_order_id = '$orderid'"; // execute SQL statement $result3 = mysqli_query($link, $query3) or die(mysqli_error($link)); $subject = "Order confirmed by Home and decor"; $message = "Hello! This is a message to inform that your order has been confirmed"; $from = "[email protected]"; $headers = "From: $from"; while($row3 = mysqli_fetch_array($result3)){ $addresses[] = $row3['email']; } $to = implode(",", $addresses); mail($to, $subject, $message, $headers); ?>

    Read the article

  • Why TR not taking style?

    - by metal-gear-solid
    CSS table tr {border-bottom:1px solid #008999} HTML <table width="100%" cellspacing="0" cellpadding="0"> <thead> <tr> <th scope="col">one</th> <th scope="col">two</th> <th scope="col">three</th> </tr> </thead> <tbody> <tr> <th scope="row">Hello</th> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </tbody> </table>

    Read the article

  • ASP.NET MVC 3 NOT showing appropriate view, action called using jquery

    - by TunAntun
    I have a small problem. My action is : public ViewResult SearchForRooms(int HotelDDL) { List<Room> roomsInHotel = bl.ReturnRoomsPerHotel(HotelDDL); return View(roomsInHotel); } Here is the jquery that is calling the action: <script type="text/javascript" language="javascript"> $(document).ready(function () { $("#HotelDDL").change(function () { var text = $("#HotelDDL option:selected").text(); var value = $("#HotelDDL option:selected").val(); alert("Selected text=" + text + " Selected value= " + value); $.post("/Home/SearchForRooms", { HotelDDL: $("#HotelDDL option:selected").val() }); }); }); </script> And finally, here is the View that should be called: @model IEnumerable<RoomReservation.Entities.Entities.Room> @{ ViewBag.Title = "Search"; } <h2>Result</h2> <table> <tr> <th> City </th> <th> Hotel </th> <th> Room label </th> <th> Number of beds </th> <th> Price per night </th> <th></th> </tr> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelitem=>item.Hotel.City.Name) </td> <td> @Html.DisplayFor(modelItem => item.Hotel.Name) </td> <td> @Html.DisplayFor(modelItem => item.Name) </td> <td> @Html.DisplayFor(modelItem => item.NumberOfBeds) </td> <td> @Html.DisplayFor(modelItem => item.PricePerNight) </td> </tr> } </table> Everthing is working ok (databse return all rooms correctly) except final view rendering. I have tried Phil's tool but it doesn't give me any suspicious hints: RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); So, why is it not showing after jscript send it's post method to SearchForRooms()? Thank you P.S. If you need any other piece of code please just say so.

    Read the article

  • On asp:Table Control how do we create a thead ?

    - by balexandre
    from MSDN article on the subject we can see that we create a TableHeaderRowthat conatins TableHeaderCells. but they add the table header like this: myTable.Row.AddAt(0, headerRow); witch outputs the HTML: <table id="Table1" ... > <tr> <th scope="column" abbr="Col 1 Head">Column 1 Header</th> <th scope="column" abbr="Col 2 Head">Column 2 Header</th> <th scope="column" abbr="Col 3 Head">Column 3 Header</th> </tr> <tr> <td>(0,0)</td> <td>(0,1)</td> <td>(0,2)</td> </tr> ... and it should have <thead> and <tbody> (so it works seamless with tablesorter) :) <table id="Table1" ... > <thead> <tr> <th scope="column" abbr="Col 1 Head">Column 1 Header</th> <th scope="column" abbr="Col 2 Head">Column 2 Header</th> <th scope="column" abbr="Col 3 Head">Column 3 Header</th> </tr> </thead> <tbody> <tr> <td>(0,0)</td> <td>(0,1)</td> <td>(0,2)</td> </tr> ... </tbody> the HTML aspx code is <asp:Table ID="Table1" runat="server" /> How can I output the correct syntax? Just as information, the GridViewcontrol has this builed in as we just need to set teh Accesbility and use the HeaderRow gv.UseAccessibleHeader = true; gv.HeaderRow.TableSection = TableRowSection.TableHeader; gv.HeaderRow.CssClass = "myclass"; but the question is for the Table control.

    Read the article

  • AngularJS databinding

    - by user3652865
    How can I add multiple values to one object in an Array. I am having Environment and Cluster, I am able to assign multiple clusters to one environment. Now I want to add application name to this environment and cluster pair. I am having page called "Add Application". Here I am using select menu to for environment and Cluster. My first question is, when I select environment then want to show only those clusters which are assigned to that environment name. And assign application name to that pair. Also should be able to edit the Application field. I am using environmentServices and clusterServices to store updated data. link of JSFiddle: http://jsfiddle.net/avinashMaddy/J2KLK/5/ Please if someone can help me in this. Below is my code: <div class="maincontent" ng-controller="manageApplicationController"> <div class="article"> <form> <section> <!-- Environment --> <div class="col-md-4"> <label>Environment:</label> <select ng-model="newApp.selectedEnvironment" class="form-control" ng-options="environment.name for environment in environments"> <option value='' disabled style='display:none;'> Select Environment </option> </select> <span> <select ng-switch-when="true" disabled ng-model="newApp.selectedEnvironment" class="form-control" ng-options="environment.name for environment in environments"> <option value='' disabled style='display:none;'> Select Environment </option> </select> </span> </div> <!-- Cluster --> <div class="col-md-4"> <label>Cluster:</label> <span ng-switch on="newApp.showCancel"> <select ng-switch-default ng-model="newApp.selectedCluster" class="form-control" ng-options="cluster for cluster in clusters"> <option value='' disabled style='display:none;'> Select Environment </option> </select> <select ng-switch-when="true" disabled ng-model="newApp.selectedCluster" class="form-control" ng-options="cluster for cluster in clusters"> <option value='' disabled style='display:none;'> Select Environment </option> </select> </span> </div> <!-- Application Name --> <div class="col-md-4"> <label>Application Name:</label> <input type="text" class="form-control" name="applicationName" placeholder="Application" ng-model="app.name" required> <br/> <input type="hidden" ng-model="app.id" /> </div> </section> <!-- submit button --> <section class="col-md-12"> <button type="button" class="btn btn-default pull-right" ng-click="saveNewApplicatons()">Save</button> </section> </form> </div> <!-- table --> <div class="article"> <table class="table table-bordered table-striped"> <tr> <th colspan="6"> <div class="pull-left">Cluster Info</div> </th> </tr> <tr> <th>Environment</th> <th>Cluster</th> <th>Application</th> <th>Edit</th> <th>Header Ifo</th> </tr> <tr ng-repeat="app in applications"> <td>{{app.environment}}</td> <td>{{app.cluster}}</td> <td>{{app.name}}</td> <td> <a href="" ng-click="edit(app.id)" title="Edit">edit</span></a> | <a href="" ng-click="remove(app.id)" title="Delete">delete</a> </td> <td> <!-- Add template --> <script type="text/ng-template" id="addHederInfo.html"> <div class="modal-header"> <h3>Add Header Info</h3> </div> <div class="modal-body"> <input type="text" class="form-control" name="eName" placeholder="Header Key" ng-model="$parent.header.key"> <br/> <input type="text" class="form-control" name="eName" placeholder="Header Value" ng-model="$parent.header.value"> <br /> <input type="hidden" ng-model="header.id" /> <section> <div class="pull-right"> <button class="btn btn-primary" ng-click="saveHeader()">Add</button> <button class="btn btn-warning" ng-click="cancel()">Close</button> </div> </section> </div> <div class="modal-footer"> <h3>Existing Header Info for </h3> <table class="table table-bordered table-striped"> <tr> <th>Header Key</th> <th>Header Vlaue</th> </tr> <tr ng-repeat="header in headers"> <td>{{header.key}}</td> <td>{{header.value}}</td> </tr> </table> </div> </script> <!-- /Add template --> <script type="text/ng-template" id="editHederInfo.html"> <div class="modal-header"> <h3>Edit Header Info</h3> </div> <div class="modal-body"> <input type="text" class="form-control" name="eName" placeholder="Header Key" ng-model="$parent.header.key"> <br/> <input type="text" class="form-control" name="eName" placeholder="Header Value" ng-model="$parent.header.value"> <br /> <input type="hidden" ng-model="header.id" /> <section> <div class="pull-right"> <button class="btn btn-primary" ng-click="saveHeader()">Update</button> <button class="btn btn-warning" ng-click="cancel()">Close</button> </div> </section> </div> <div class="modal-footer"> <h3>Existing Header Info for</h3> <table class="table table-bordered table-striped"> <tr> <th>Header Key</th> <th>Header Vlaue</th> <th>Edit</th> </tr> <tr ng-repeat="header in headers"> <td>{{header.key}}</td> <td>{{header.value}}</td> <td> <a href="" ng-click="editHeader(header.id)" title="Edit"><span class="glyphicon glyphicon-edit" ></span></a> | <a href="" ng-click="removeHeader(header.id)" title="Edit"><span class="glyphicon glyphicon-trash"></span></a> </td> </tr> </table> </div> </script> <!-- Add template --> <!-- /Add template --> <a href="" ng-click="addInfo()">Add</a> | <a href="" ng-click="editInfo()">Edit</a> </td> </tr> </table> </div> </div> Controller.js: var apsApp = angular.module('apsApp', []); apsApp.service('clusterService', function(){ var clusters=[]; //simply returns the environment list this.list = function () { return clusters; }; }); apsApp.service('environmentService', function(){ var environments=[ {name :'DEV',}, {name:'PROD',}, {name:'QA',}, {name:'Linux_Dev',} ]; //simply returns the environment list this.list = function () { return environments; }; apsApp.controller('manageApplicationController', function ($scope, environmentService, clusterService) { var uid = 0; $scope.environments= environmentService.list(); $scope.clusters= clusterService.list(); $scope.newApp = {}; $scope.newApp.selectedEnvironment = $scope.environments[0]; $scope.newApp.selectedCluster = $scope.clusters[0]; $scope.newApp.buttonLabel = 'Save'; $scope.newApp.showCancel = false; /*$scope.applications=[ {'name': 'Enterprice App Store' }, {'name': 'UsageGateway'}, {'name': 'Click 2 Fill'}, {'name': 'ATT SmartWiFi'} ];*/ //add new application $scope.saveNewApplicatons = function() { if ($scope.select.id == undefined) { //if this is new application, add it in applications array $scope.clusters.push({ id: uid++, cluster: $scope.newApp.cluster, environment: $scope.newApp.selectedEnvironment }); } else { $scope.clusters[$scope.select.id].cluster = $scope.select.cluster; $scope.newApp.id = undefined; $scope.newApp.buttonLabel = 'Save Cluster'; $scope.newApp.showCancel = false; }; //clear the add appplicaitons form $scope.newApp.selectedEnvironment = $scope.environments[0]; }; //delete application $scope.remove = function (id) { //search app with given id and delete it for (i in $scope.clusters) { if ($scope.clusters[i].id == id) { confirm("This Cluster will get deleted permanently"); $scope.clusters.splice(i, 1); $scope.clust = {}; } } }; $scope.cancelUpdate = function () { $scope.newApp.buttonLabel = 'Save Cluster'; $scope.newApp.showCancel = false; $scope.newApp.id = undefined; $scope.newApp.cluster = ""; $scope.newApp.selectedEnvironment = $scope.environments[0]; }; });

    Read the article

  • delete row from mysql through generated table with records

    - by HennySmafter
    I am using 2 pages. On one page it generates a table with the records and a delete button. After pressing delete it goes to the second page which should delete the record. But it doesn't. Below is the code that I am using. PS: The code is adapted from a tutorial I found through Google a while ago. delete_overzicht.php <?php // Load Joomla! configuration file require_once('../../../configuration.php'); // Create a JConfig object $config = new JConfig(); // Get the required codes from the configuration file $server = $config->host; $username = $config->user; $password = $config->password; $database = $config->db; // Connect to db $con = mysqli_connect($server,$username,$password,$database); if (!$con){ die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,$database); // Get results $result = mysqli_query($con,"SELECT * FROM cypg8_overzicht"); echo "<table border='1' id='example' class='tablesorter'><thead><tr><th>Formulier Id</th><th>Domeinnaam</th><th>Bedrijfsnaam</th><th>Datum</th><th>Periode</th><th>Subtotaal</th><th>Dealernaam</th><th>Verwijderen</th></tr></thead><tbody>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['formuliernummer'] . "</td>"; echo "<td>" . $row['domeinnaam'] . "</td>"; echo "<td>" . $row['bedrijfsnaam'] . "</td>"; echo "<td>" . $row['datum'] . "</td>"; echo "<td>" . $row['periode'] . "</td>"; echo "<td> &euro; " . $row['subtotaal'] . "</td>"; echo "<td>" . $row['dealercontactpersoon'] . "</td>"; echo "<td><a href='delete.php?id=" . $row['id'] . "'>Verwijderen </a></td>"; echo "</tr>"; } echo "</tbody></table>"; mysqli_close($con); ?> delete.php <?php // Load Joomla! configuration file require_once('../../../configuration.php'); // Create a JConfig object $config = new JConfig(); // Get the required codes from the configuration file $server = $config->host; $username = $config->user; $password = $config->password; $database = $config->db; // Connect to db $con = mysqli_connect($server,$username,$password,$database); if (!$con){ die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,$database); // Check whether the value for id is transmitted if (isset($_GET['id'])) { // Put the value in a separate variable $id = $_GET['id']; // Query the database for the details of the chosen id $result = mysqli_query($con,"DELETE * FROM cypg8_overzicht WHERE id = $id"); } else { die("No valid id specified!"); } ?> Thanks to everyone who is willing to help!

    Read the article

  • How do I simplify this php script

    - by user225269
    Any suggestions on how I can simplify the php script below?This was my previous question: http://stackoverflow.com/questions/2712237/how-to-check-if-a-checkbox-radio-button-is-checked-in-php that is linked to this one, What I'm trying to do here is to output the data depending on the checkbox that is checked. But my code isn't really good, it shows 2 tables if the condition is met by the 2 results. As you can see in the code below, any suggestions on how I can simplify this? <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $id = mysql_real_escape_string($_POST['idnum']); if ( $_POST['yr'] == 'year' and $_POST['sec'] == 'section' ){ $result2 = mysql_query("SELECT * FROM student WHERE IDNO='$id'"); echo "<table border='1'> <tr> <th>IDNO</th> <th>YEAR</th> <th>SECTION</th> </tr>"; while($row = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td>" . $row['IDNO'] . "</td>"; echo "<td>" . $row['YEAR'] . "</td>"; echo "<td>" . $row['SECTION'] . "</td>"; echo "</tr>"; } echo "</table>"; } if ( $_POST['yr'] == 'year' and $_POST['sec'] == 'section' and $_POST['lname'] == 'lastname'){ $result3 = mysql_query("SELECT * FROM student WHERE IDNO='$id'"); echo "<table border='1'> <tr> <th>IDNO</th> <th>YEAR</th> <th>SECTION</th> <th>LASTNAME</th> </tr>"; while($row = mysql_fetch_array($result3)) { echo "<tr>"; echo "<td>" . $row['IDNO'] . "</td>"; echo "<td>" . $row['YEAR'] . "</td>"; echo "<td>" . $row['SECTION'] . "</td>"; echo "<td>" . $row['LASTNAME'] . "</td>"; echo "</tr>"; } echo "</table>"; } mysql_close($con); ?>

    Read the article

  • Building a jQuery Plug-in to make an HTML Table scrollable

    - by Rick Strahl
    Today I got a call from a customer and we were looking over an older application that uses a lot of tables to display financial and other assorted data. The application is mostly meta-data driven with lots of layout formatting automatically driven through meta data rather than through explicit hand coded HTML layouts. One of the problems in this apps are tables that display a non-fixed amount of data. The users of this app don't want to use paging to see more data, but instead want to display overflow data using a scrollbar. Many of the forms are very densely populated, often with multiple data tables that display a few rows of data in the UI at the most. This sort of layout does not lend itself well to paging, but works much better with scrollable data. Unfortunately scrollable tables are not easily created. HTML Tables are mangy beasts as anybody who's done any sort of Web development knows. Tables are finicky when it comes to styling and layout, and they have many funky quirks, especially when it comes to scrolling both of the table rows themselves or even the child columns. There's no built-in way to make tables scroll and to lock headers while you do, and while you can embed a table (or anything really) into a scrolling div with something like this: <div style="position:relative; overflow: hidden; overflow-y: scroll; height: 200px; width: 400px;"> <table id="table" style="width: 100%" class="blackborder" > <thead> <tr class="gridheader"> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> <th >Column 4</th> </tr> </thead> <tbody> <tr> <td>Column 1 Content</td> <td>Column 2 Content</td> <td>Column 3 Content</td> <td>Column 4 Content</td> </tr> <tr> <td>Column 1 Content</td> <td>Column 2 Content</td> <td>Column 3 Content</td> <td>Column 4 Content</td> </tr> … </tbody> </table> </div> </div> that won't give a very satisfying visual experience: Both the header and body scroll which looks odd. You lose context as soon as the header scrolls off the top and when you reach the bottom of the list the bottom outline of the table shows which also looks off. The the side bar shows all the way down the length of the table yet another visual miscue. In a pinch this will work, but it's ugly. What's out there? Before we go further here you should know that there are a few capable grid plug-ins out there already. Among them: Flexigrid (can work of any table as well as with AJAX data) jQuery Scrollable Table Plug-in (feature similar to what I need but not quite) jqGrid (mostly an Ajax Grid which is very powerful and works very well) But in the end none of them fit the bill of what I needed in this situation. All of these require custom CSS and some of them are fairly complex to restyle. Others are AJAX only or work better with AJAX loaded data. However, I need to actually try (as much as possible) to maintain the original styling of the tables without requiring extensive re-styling. Building the makeTableScrollable() Plug-in To make a table scrollable requires rearranging the table a bit. In the plug-in I built I create two <div> tags and split the table into two: one for the table header and one for the table body. The bottom <div> tag then contains only the table's row data and can be scrolled while the header stays fixed. Using jQuery the basic idea is pretty simple: You create the divs, copy the original table into the bottom, then clone the table, clear all content append the <thead> section, into new table and then copy that table into the second header <div>. Easy as pie, right? Unfortunately it's a bit more complicated than that as it's tricky to get the width of the table right to account for the scrollbar (by adding a small column) and making sure the borders properly line up for the two tables. A lot of style settings have to be made to ensure the table is a fixed size, to remove and reattach borders, to add extra space to allow for the scrollbar and so forth. The end result of my plug-in is a table with a scrollbar. Using the same table I used earlier the result looks like this: To create it, I use the following jQuery plug-in logic to select my table and run the makeTableScrollable() plug-in against the selector: $("#table").makeTableScrollable( { cssClass:"blackborder"} ); Without much further ado, here's the short code for the plug-in: (function ($) { $.fn.makeTableScrollable = function (options) { return this.each(function () { var $table = $(this); var opt = { // height of the table height: "250px", // right padding added to support the scrollbar rightPadding: "10px", // cssclass used for the wrapper div cssClass: "" } $.extend(opt, options); var $thead = $table.find("thead"); var $ths = $thead.find("th"); var id = $table.attr("id"); var cssClass = $table.attr("class"); if (!id) id = "_table_" + new Date().getMilliseconds().ToString(); $table.width("+=" + opt.rightPadding); $table.css("border-width", 0); // add a column to all rows of the table var first = true; $table.find("tr").each(function () { var row = $(this); if (first) { row.append($("<th>").width(opt.rightPadding)); first = false; } else row.append($("<td>").width(opt.rightPadding)); }); // force full sizing on each of the th elemnts $ths.each(function () { var $th = $(this); $th.css("width", $th.width()); }); // Create the table wrapper div var $tblDiv = $("<div>").css({ position: "relative", overflow: "hidden", overflowY: "scroll" }) .addClass(opt.cssClass); var width = $table.width(); $tblDiv.width(width).height(opt.height) .attr("id", id + "_wrapper") .css("border-top", "none"); // Insert before $tblDiv $tblDiv.insertBefore($table); // then move the table into it $table.appendTo($tblDiv); // Clone the div for header var $hdDiv = $tblDiv.clone(); $hdDiv.empty(); var width = $table.width(); $hdDiv.attr("style", "") .css("border-bottom", "none") .width(width) .attr("id", id + "_wrapper_header"); // create a copy of the table and remove all children var $newTable = $($table).clone(); $newTable.empty() .attr("id", $table.attr("id") + "_header"); $thead.appendTo($newTable); $hdDiv.insertBefore($tblDiv); $newTable.appendTo($hdDiv); $table.css("border-width", 0); }); } })(jQuery); Oh sweet spaghetti code :-) The code starts out by dealing the parameters that can be passed in the options object map: height The height of the full table/structure. The height of the outside wrapper container. Defaults to 200px. rightPadding The padding that is added to the right of the table to account for the scrollbar. Creates a column of this width and injects it into the table. If too small the rightmost column might get truncated. if too large the empty column might show. cssClass The CSS class of the wrapping container that appears to wrap the table. If you want a border around your table this class should probably provide it since the plug-in removes the table border. The rest of the code is obtuse, but pretty straight forward. It starts by creating a new column in the table to accommodate the width of the scrollbar and avoid clipping of text in the rightmost column. The width of the columns is explicitly set in the header elements to force the size of the table to be fixed and to provide the same sizing when the THEAD section is moved to a new copied table later. The table wrapper div is created, formatted and the table is moved into it. The new wrapper div is cloned for the header wrapper and configured. Finally the actual table is cloned and cleared of all elements. The original table's THEAD section is then moved into the new table. At last the new table is added to the header <div>, and the header <div> is inserted before the table wrapper <div>. I'm always amazed how easy jQuery makes it to do this sort of re-arranging, and given of what's happening the amount of code is rather small. Disclaimer: Your mileage may vary A word of warning: I make no guarantees about the code above. It's a first cut and I provided this here mainly to demonstrate the concepts of decomposing and reassembling an HTML layout :-) which jQuery makes so nice and easy. I tested this component against the typical scenarios we plan on using it for which are tables that use a few well known styles (or no styling at all). I suspect if you have complex styling on your <table> tag that things might not go so well. If you plan on using this plug-in you might want to minimize your styling of the table tag and defer any border formatting using the class passed in via the cssClass parameter, which ends up on the two wrapper div's that wrap the header and body rows. There's also no explicit support for footers. I rarely if ever use footers (when not using paging that is), so I didn't feel the need to add footer support. However, if you need that it's not difficult to add - the logic is the same as adding the header. The plug-in relies on a well-formatted table that has THEAD and TBODY sections along with TH tags in the header. Note that ASP.NET WebForm DataGrids and GridViews by default do not generate well-formatted table HTML. You can look at my Adding proper THEAD sections to a GridView post for more info on how to get a GridView to render properly. The plug-in has no dependencies other than jQuery. Even with the limitations in mind I hope this might be useful to some of you. I know I've already identified a number of places in my own existing applications where I will be plugging this in almost immediately. Resources Download Sample and Plug-in code Latest version in the West Wind Web & AJAX Toolkit Repository © Rick Strahl, West Wind Technologies, 2005-2011Posted in jQuery  HTML  ASP.NET  

    Read the article

  • What should I do that GWT use <th> instead of <td>?

    - by Paulus
    To build a HTML table I use direct DOM instead of a predefined Widget to set thead and tbody. But when I insert a cell with the insertCell() method GWT inserts an td element but should insert an th element. So TableElement table = Document.get().createTableElement(); TableSectionElement thead = table.createTHead(); TableRowElement headRow = thead.insertRow(-1); headRow.insertCell(-1).setInnerText( "header1" ); gives table/thead/tr/td but should give table/thead/tr/th Any idea how to solve this problem? Use the "old-school" DOM.createXXX()-Methods?

    Read the article

  • Styling specific columns and rows

    - by hattenn
    I'm trying to style some specific parts of a 5x4 table that I create. It should be like this: Every even numbered row and every odd numbered row should get a different color. Text in the second, third, and fourth columns should be centered. I have this table: <table> <caption>Some caption</caption> <colgroup> <col> <col class="value"> <col class="value"> <col class="value"> </colgroup> <thead> <tr> <th id="year">Year</th> <th>1999</th> <th>2000</th> <th>2001</th> </tr> </thead> <tbody> <tr class="oddLine"> <td>Berlin</td> <td>3,3</td> <td>1,9</td> <td>2,3</td> </tr> <tr class="evenLine"> <td>Hamburg</td> <td>1,5</td> <td>1,3</td> <td>2,0</td> </tr> <tr class="oddLine"> <td>München</td> <td>0,6</td> <td>1,1</td> <td>1,0</td> </tr> <tr class="evenLine"> <td>Frankfurt</td> <td>1,3</td> <td>1,6</td> <td>1,9</td> </tr> </tbody> <tfoot> <tr class="oddLine"> <td>Total</td> <td>6,7</td> <td>5,9</td> <td>7,2</td> </tr> </tfoot> </table> And I have this CSS file: table, th, td { border: 1px solid black; border-collapse: collapse; padding: 0px 5px; } #year { text-align: left; } .oddLine { background-color: #DDDDDD; } .evenLine { background-color: #BBBBBB; } .value { text-align: center; } And this doesn't work. The text in the columns are not centered. What is the problem here? And is there a way to solve it (other than changing the class of all the cells that I want centered)? P.S.: I think there's some interference with .evenLine and .oddLine classes. Because when I put "background: black" in the class "value", it changes the background color of the columns in the first row. The thing is, if I delete those two classes, text-align still doesn't work, but background attribute works perfectly. Argh...

    Read the article

  • jQueryUI: Sortable <thead> messes up ie ANY IE when css display property is set to RELATIVE

    - by Zlatev
    As the title describes most of the problem. Here is the example code that works as expected in Firefox. Could someone provide a workaround or fix? In action JavaScript $(function() { $('table thead').sortable({ items: 'th', containment: 'document', helper: 'clone', cursor: 'move', placeholder: 'placeHold', start: function(e, ui) { $overlay=$('<div>').css({ position: 'fixed', left: 0, top: 0, backgroundColor: 'black', opacity: 0.4, width: '100%', height: '100%', zIndex: 500 }).attr('id','sortOverlay').prependTo(document.body); $(this).parent().css({ position: 'relative', zIndex: 1000}); }, stop: function(e, ui){ $('#sortOverlay').remove(); $(this).parent().css({ position: 'static' }); } }); }); CSS <style type="text/css"> table { background-color: #f3f3f3; } table thead { background-color: #c1c1c1; } .placeHold { background-color: white; } </style> HTML <table> <thead><th>th1</th><th>th2</th><th>th3</th><th>th4</th></thead> <tbody> <tr> <td>content</td><td>content</td><td>content</td><td>content</td> </tr> </tbody> </table>

    Read the article

  • How are table headers supposed to be used?

    - by stevebot
    Hi, Recently I saw some code like this: <tr> <th> Some label: </th> <td> <input type="text" value=""/> </td> <th> Another label: </th> <td> <input type="text" value=""/> </td> </tr> I am used to table headers being used like <tr> <th> Some label: </th> <th> Another label: </th> </tr> <tr> <td> <input type="text" value=""/> </td> <td> <input type="text" value=""/> </td> </tr> How are table headers supposed to be used? The first example above, lead me to some pretty funky formatting issues, and it seems like in example 1 <label> should be used in place of <th>.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >