So re-doing how our program handles data and now we just need to be able to extract the ID from the first column of our table and it will be passed over to a java method to handle it from there. But now getting caught up on how to get the value of our ID column. Basically all our tables have the first column 'ID' which contain unique values. I have read through about 20 pages of questions on getting IDs back and not a single one has worked yet.
What i want to do is be able to highlight one (or possibly multiple if it isn't too hard) rows, and then click a button which would make a call to a function and pass in the # value from the first row 'ID'. Any help would be great! Heres the code as it stands:
As you can see its a mix of trying to use the editor functionality but thats somewhat complex as my work wont pay for the 'full' version, so we are also toying with the idea of using a button at the end of each row with a 'new/edit/delete' links. If we click on the delete button have it call 'deleteMDR+ValueOf'ID' or somethign like that.....
What i want to do is be able to highlight one (or possibly multiple if it isn't too hard) rows, and then click a button which would make a call to a function and pass in the # value from the first row 'ID'. Any help would be great! Heres the code as it stands:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> <%@ page session="false" %> <jsp:include page="header.jsp" /> <link rel="stylesheet" type="text/css" href="content/css/jquery.dataTables.css" /> <link rel="stylesheet" type="text/css" href="content/css/dataTables.tabletools.css" /> <link rel="stylesheet" type="text/css" href="content/css/dataTables.editor.css" /> <script type="text/javascript" src="content/js/jquery.min.js"></script> <script type="text/javascript" src="content/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="content/js/dataTables.tabletools.min.js"></script> <script type="text/javascript" src="content/js/dataTables.editor.min.js"></script> <script> $(document).ready(function() { $('#demo').html( '<table class="display" id="example"></table>' ); var editor = new $.fn.dataTable.Editor( { "ajaxUrl": 'dataTable/edit', "domTable": "#example", "fields": [ {"label": "ID:","name": "id"}, {"label": "Version:", "name": "version" }, {"label": "Name:", "name": "name" }, {"label": "Application Name:", "name": "applicationName" }, {"label": "Application Version:", "name": "applicationVersion" }, {"label": "Availability:", "name": "availability" }, {"label": "Baseline Load:", "name": "baselineLoad" }, {"label": "Color", "name": "color"}, {"label": "Implementation ID", "name": "implementationId"}, {"label": "Quantity", "name": "quantity"}, {"label": "Label", "name": "label"}, {"label": "Location", "name": "location"}, {"label": "Application Owner", "name": "applicationOwner"}, {"label": "Architecture Owner", "name": "architectureOwner"}, {"label": "Data Owner", "name": "dataOwner"}, {"label": "Is Ola Agreed?", "name": "olaAgreed"}, {"label": "Is Recognized", "name": "recognized"}, {"label": "Is Strategic", "name": "strategic"}, {"label": "Resolved Time UTC", "name": "resolvedTimeUTC"} ] } ); $('#example').dataTable( { "bJQueryUI": true, "bPaginate": true, "sPaginationType": "full_numbers", "iDisplayLength": 5, "sDom": 'T<"H"fl>t<"F"ip>', "sAjaxSource": 'dataTable/getData', "aoColumns": [ { "mData": "id", "sTitle": "ID" }, { "mData": "version", "sTitle":"Version" }, { "mData": "name", "sTitle": "Name" }, { "mData": "applicationName", "sTitle": "Application Name" }, { "mData": "applicationVersion", "sTitle": "Application Version" }, { "mData": "availability", "sTitle": "Availability" }, { "mData": "baselineLoad", "sTitle": "Baseline Load"}, { "mData": "color", "sTitle": "Color"}, { "mData": "implementationId", "sTitle": "Implementation ID"}, { "mData": "quantity", "sTitle": "Quantity" }, { "mData": "label", "sTitle": "Label" }, { "mData": "location", "sTitle": "Location" }, { "mData": "applicationOwner", "sTitle": "Application Owner" }, { "mData": "architectureOwner", "sTitle": "Architecture Owner" }, { "mData": "dataOwner", "sTitle": "Data Owner" }, { "mData": "olaAgreed", "sTitle": "Is OLA Agreed" }, { "mData": "recognized", "sTitle": "Is Recognized?" }, { "mData": "strategic", "sTitle": "Is Strategic?" }, { "mData": "resolvedTimeUTC", "sTitle": "Resolved Time UTC" }, { "mData": null, "sClass": "center", "sDefaultContent": '<a href="dataTable/deleteMDR" >Delete</a>' } ], "oTableTools": { "sRowSelect": "multi", "aButtons": [ { "sExtends": "editor_create", "editor": editor }, { "sExtends": "editor_edit", "editor": editor }, { "sExtends": "editor_remove", "editor": editor } ] } //close table tools }); //close DT } ); //close function </script> <table> <tr> <td><div id="sidebar"><jsp:include page="sidebar.jsp"/></div> </td> <td><div id="demo"></div> </td> </tr> </table> <jsp:include page="footer.jsp" />
As you can see its a mix of trying to use the editor functionality but thats somewhat complex as my work wont pay for the 'full' version, so we are also toying with the idea of using a button at the end of each row with a 'new/edit/delete' links. If we click on the delete button have it call 'deleteMDR+ValueOf'ID' or somethign like that.....