Tag: datatable

谷歌图表,将dataTable行追加到其他dataTable

我有2个google.visualization.DataTable(数据) 我想将1个dataTable的行追加到另一个dataTable。 我怎么做? 示例表1: 1 | test1 | 20 2 | test2 | 三十 示例表2: 3 | test3 | 60 4 | test4 | 40 我想将2合并为: 1 | test1 | 20 2 | test2 | 三十 3 | test3 | 60 4 | test4 | 40 google.charts.load(‘current’, { callback: drawChart, packages:[‘table’] }); var json1 = […]

jquery:访问datatable中文本框的值

在数据表中,我通过追加添加了一个文本框列(第2列) : var textbox= ”; 但现在,我想获得文本框的价值。 我这样做是通过: var row_index; $(document).on(‘mouseover’, ‘#table1 tr’, function() { row_index = this.rowIndex; }); function getIncrement() { var dtable = $(‘#table1′).DataTable(); var textvalue = dtable.rows(row_index).cells(1).value; //textbox column is 2nd alert(parseFloat(textvalue)); } 问题是我得到‘NaN’ (非数字)值。 如果我删除parseFloat,我会得到’undefined’。 有任何想法吗? 先感谢您。 PS的row_index值就好了。 如果我使用alert来获取其值,我将获得正确的索引。 此外,使用索引获取其他行值的值没有问题。 我只对“txtbox”列有问题。 谢谢

合并2谷歌图表dataTables为1

我有2个谷歌图表dataTables,我想合并到1谷歌图表dataTable。 示例表1: 1 | test1 | 20 2 | test2 | 三十 示例表2: 1 | test1 | 20 3 | test3 | 60 我想将2合并为: 1 | test1 | 20 2 | test2 | 三十 3 | test3 | 60 最好的方法是什么? 我的代码现在不合并它们,只是添加行和列。 docs: https : //developers.google.com/chart/interactive/docs/reference#join oldjson = ‘ { “cols”: [ {“id”:””,”label”:”Topping”,”pattern”:””,”type”:”string”}, {“id”:””,”label”:”Slices”,”pattern”:””,”type”:”number”} ], “rows”: […]

无法使用数据表和自由编辑器编辑/创建/删除表中的元素

我正在尝试使用AJAX调用的JSON格式的数据构建一个可编辑的表。 为此,我使用Datatables插件和Free Datatables Editor(kingkode.com/free-datatables-editor-alternative/)。 我不能使用Datatables Editor,因为我只能使用开源的库。 目前我只是使用自己的simpleHTTPserver来提供JSON,这就是链接指向localhost的原因。 该表最初显示了正确的数据,但我无法编辑/创建/删除任何元素,因为所选行的值似乎未定义,并且在确认/提交时提供错误。 错误图片: 删除 – 似乎值未定义 创建 – 错误消息 我不明白我错过了什么或做错了什么,所以任何可以让我走上正轨的帮助都会很棒! 脚本: $(document).ready(function() { var columnDefs = [{ title: “NTP Servers”, data: “ntp_server” }]; //Table creation var myTable = $(‘#testTableData’).dataTable({ “ajax”: “http://localhost:6112/data.php”, columns: columnDefs, dom: ‘Bfrltip’, select: ‘single’, responsive: true, altEditor: true, buttons: [{ text: ‘Create’, name: ‘add’ }, { […]

如何从php获取数据表jquery插件的json数据

我是PHP的新手,我正在尝试使用Datatables jQuery插件。 我知道我必须从.php文件中获取数据,然后在我的数据表中使用它,但我似乎无法通过ajax将其传递给datatables。 我设法从数据库中获取数据,json对其进行编码,但后来我不知道如何将其调用到我的index.php文件中,我需要在其中显示它。 我究竟做错了什么? 这是我的代码: HTML(已编辑): $( document ).ready(function() { $(‘#tabela’).dataTable({ ‘bJQueryUI’ : true, ‘sPaginationType’ : ‘full_numbers’, ‘bRetrieve’ : true, ‘bFilter’ : true, ‘iDisplayLength’: 10, ‘bProcessing’ : true, “sAjaxSource”: “adminmysqli.php” }); }); 来自fetchdata.php的数据: {“iTotalRecords”:”41″,”iTotalDisplayRecords”:”41″,”aaData”: [[“2″,”Arya”,”Stark”,”612345555″,”Braavos”], [“3″,”Jon”,”Snow”,”612345655″,”The”], [“4″,”Meryn”,”Trant”,”612345679″,”Tirane”], [“5″,”Sansa”,”Stone”,”692345678″,”Durres”], [“6″,”Myda”,”Slate”,”612345676″,”Tirane”], [“7″,”Varys”,”Bird”,”612345689″,”Tirane”], [“9″,”Stannis”,”Baratheon”,”612345678″,”Tirane”], [“10″,”Shireen”,”Burn”,”612345678″,”Iron”], [“11″,”Selyse”,”Tully”,”612345678″,”Tirane”], [“12″,”Lyanna”,”Dread”,”612345678″,”Tirane”], [“13″,”Viserys”,”Targaryen”,”612345678″,”Durres”], [“14″,”Daennerys”,”Stormborn”,”612345678″,”Tirane”], [“15″,”Khaal”,”Drogo”,”612345678″,”Tirane”], [“16″,”Jojen”,”Reed”,”612345678″,”Tirane”], [“17″,”Theon”,”Greyjoy”,”612345678″,”Tirane”], [“18″,”Osha”,”Green”,”612345678″,”Tirane”], [“19″,”Oberyn”,”Martell”,”612345678″,”Tirane”], [“20″,”Ellaria”,”Sands”,”612345678″,”Tirane”], [“22″,”Tommen”,”Laster”,”612345678″,”Tirane”], [“23″,”Robert”,”Baratheon”,”612345678″,”Tirane”], […]

jQuery DataTable设置标题按钮单击

在我看来,我有2个输入字段,1个按钮和1个表,我使用的是jQuery DataTables 。 我在我的数据表上使用打印function 。 我试图根据2个输入字段的值设置打印页面的标题,但它不起作用。 在页面加载时,2个输入字段将为空白…这是按钮发挥作用的位置。 如果单击该按钮,则这两个字段都将具有值,并且我需要将这些值合并到标题中。 这是我的jQuery: var startDate = “”; var endDate = “”; $(“#Search-Btn”).click(function() { startDate = $(“#Start-Date”).val(); endDate = $(“#End-Date”).val(); }); var firstTable = $(“#Month-Table”).DataTable({ dom: ‘Bfrtip’, buttons: [ { extend: ‘print’, title: ‘Title For ‘ + locationName + ‘ ‘ + startDate + ‘ – ‘ + endDate, exportOptions: […]

左侧固定列与表colspan

我使用过这个.js文件和以下方法。 https://code.jquery.com/jquery-3.3.1.js https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js https://cdn.datatables.net/ fixedcolumns / 3.2.6 / JS / dataTables.fixedColumns.min.js var table = $(“#ShowDetails”).DataTable({ scrollX: true, scrollCollapse: true, paging: false, fixedColumns: { leftColumns: 1,} }); 但它不能正常工作,我需要知道如何做这样的表结构。 高亮应该冻结

jQuery DataTables:我可以为Sort提供3种状态:ASC,DESC和NO_SORT吗?

单击列标题时jQuery Datatable的排序顺序仅在asc(向下箭头)和desc(向上箭头)之间切换。 即 1st-click ascending 2nd-click descending 3rd-click asc 4th-click desc || || || || || || || || odd-click asc even-click desc. 我想引发这样的事情: 1st-click ascending 2nd-click descending 3rd-click no-sorting 4th-click asc 5th-click desc 6th-click no-sort || || || || || || || || (n%3==1)-click asc (n%3==2)-click desc (n%3==0)-click no-sort. 有没有办法在jQuery dataTables中改变这种行为? 请帮忙! 提前致谢。

在Jquery数据表搜索框中添加提示文本的问题

使用watermark.js这样的插件在Jquery数据表的搜索字段中添加灰色提示文本不是一个选项,我必须自定义编写它。 我几乎在那里,但面对下面的代码片段解释这个小而奇怪的问题。 function toggleHintText() { // alert(“The hint text should show up”); var textSuggest = “Please input search parameter”; var searchField = $(‘input:text’); searchField .attr(“value”, textSuggest ); searchField .addClass(“activeHint”); searchField .focus(function() { if(searchField .attr(“value”) == textSuggest) { searchField .attr(“value”, “”); } }); searchField .keyup(function() { if(searchField .attr(“value”) == “”) { searchField .addClass(“activeHint”); } else { […]

数据表jquery点击事件在分页后不起作用

我正在使用http://datatables.net/ Activate Account 我在onclick事件上触发ajax调用,下面是ajax调用代码: $(“.activeAccount”).click(function() { var intCounselorId = $(this).parent().parent().find(‘input[class=”counselorId”]’).attr(“value”); var intOwnerId = $(this).parent().parent().find(‘input[class=”userID”]’).attr(“value”); var strAction = ‘activateAccount’; performAction(intCounselorId, intOwnerId, strAction); }); function performAction(intCounselorId, intOwnerId, strAction) { $.ajax({ url: ‘/admin/counselormanagement/expertmanagementgridaction’, data: ‘intCounselorId=’+intCounselorId+’&intOwnerId=’+intOwnerId+’&strAction=’+strAction, type: “POST”, async:false, success: function(intFlag) { if(intFlag == 1){ location.reload(); } } }); } 我正在尝试运行一个在第一页上正常工作的onclick事件,但是一旦我转到第2页(或任何其他),它就会停止工作。 我正在使用jquery-1.10.2.min.js和1.9.4版本的数据表