Javascript DataTable—在另一个DataTable中可用的计数值

Javascript DataTable—在另一个DataTable中可用的计数值,javascript,arrays,datatables,Javascript,Arrays,Datatables,我正在使用DataTable和编辑器。如何计算另一个数据表中的可用值?我想计算(或获得数字)表_02中某个值的可用频率,并将其显示在表_01的count列中 table_01 = $('#table_01').DataTable( { dom: "Blfrtip", ajax: { url: "source_01.php", type: "POST", data: function (d) {

我正在使用DataTable和编辑器。如何计算另一个数据表中的可用值?我想计算(或获得数字)表_02中某个值的可用频率,并将其显示在表_01的count列中

table_01 = $('#table_01').DataTable( {
    dom: "Blfrtip",
    ajax: {
          url: "source_01.php",
          type: "POST",
          data: function (d) { 
                    d.selectUserID = userID;                         
                    } },
    serverSide: true,
    processing: true,
    columns: [
        { data: "name" },
        { data: "id" },
        { data: "user_id", visible: false },
        { data: "count" ,
            "render": function () {
                var json = table_02.ajax.json().data;                   
                return json.length; 
            }               
        }                              
    ],
    ...
表01:

id | value | count
1|value_01|{count of value_01 in table_02}
2|value_02|{count of value_02 in table_02}
3|value_03|{count of value_03 in table_02}
4|value_04|{count of value_04 in table_02}
5|value_05|{count of value_05 in table_02}
table_01 = $('#table_01').DataTable( {
    dom: "Blfrtip",
    ajax: {
          url: "source_01.php",
          type: "POST",
          data: function (d) { 
                    d.selectUserID = userID;                         
                    } },
    serverSide: true,
    processing: true,
    columns: [
        { data: "name" },
        { data: "id" },
        { data: "user_id", visible: false },
        { data: "count" ,
            "render": function () {
                var json = table_02.ajax.json().data;                   
                return json.length; 
            }               
        }                              
    ],
    ...
表02:

foreign_id | value
1|value_01
1|value_01
1|value_01
3|value_03
5|value_05
5|value_05  
table_01 = $('#table_01').DataTable( {
    dom: "Blfrtip",
    ajax: {
          url: "source_01.php",
          type: "POST",
          data: function (d) { 
                    d.selectUserID = userID;                         
                    } },
    serverSide: true,
    processing: true,
    columns: [
        { data: "name" },
        { data: "id" },
        { data: "user_id", visible: false },
        { data: "count" ,
            "render": function () {
                var json = table_02.ajax.json().data;                   
                return json.length; 
            }               
        }                              
    ],
    ...
我可以计算表_02中的记录,并在表_01中显示(见下文)。但是我如何筛选或仅计算例如具有“foreign_id”“1”的值

table_01 = $('#table_01').DataTable( {
    dom: "Blfrtip",
    ajax: {
          url: "source_01.php",
          type: "POST",
          data: function (d) { 
                    d.selectUserID = userID;                         
                    } },
    serverSide: true,
    processing: true,
    columns: [
        { data: "name" },
        { data: "id" },
        { data: "user_id", visible: false },
        { data: "count" ,
            "render": function () {
                var json = table_02.ajax.json().data;                   
                return json.length; 
            }               
        }                              
    ],
    ...
consol.log(json.length):11

table_01 = $('#table_01').DataTable( {
    dom: "Blfrtip",
    ajax: {
          url: "source_01.php",
          type: "POST",
          data: function (d) { 
                    d.selectUserID = userID;                         
                    } },
    serverSide: true,
    processing: true,
    columns: [
        { data: "name" },
        { data: "id" },
        { data: "user_id", visible: false },
        { data: "count" ,
            "render": function () {
                var json = table_02.ajax.json().data;                   
                return json.length; 
            }               
        }                              
    ],
    ...
consol.log(json)是:

table_01 = $('#table_01').DataTable( {
    dom: "Blfrtip",
    ajax: {
          url: "source_01.php",
          type: "POST",
          data: function (d) { 
                    d.selectUserID = userID;                         
                    } },
    serverSide: true,
    processing: true,
    columns: [
        { data: "name" },
        { data: "id" },
        { data: "user_id", visible: false },
        { data: "count" ,
            "render": function () {
                var json = table_02.ajax.json().data;                   
                return json.length; 
            }               
        }                              
    ],
    ...
还有,在哪里

table_01 = $('#table_01').DataTable( {
    dom: "Blfrtip",
    ajax: {
          url: "source_01.php",
          type: "POST",
          data: function (d) { 
                    d.selectUserID = userID;                         
                    } },
    serverSide: true,
    processing: true,
    columns: [
        { data: "name" },
        { data: "id" },
        { data: "user_id", visible: false },
        { data: "count" ,
            "render": function () {
                var json = table_02.ajax.json().data;                   
                return json.length; 
            }               
        }                              
    ],
    ...
table_01 = Object { value="Test 01",  user_id="1"}
table_02 = Object { account_id="1",  user_id="1",  uid_foreign="1",  more...}

是否可以循环使用json并仅呈现表\u 02.uid\u foreign=1的对象,以便我可以对筛选结果进行.length处理?

如果打开服务器端处理模式,则只能从单个页面中计算记录。您需要改用客户端处理模式才能访问服务器上的所有数据或计数记录。如果启用服务器端处理模式,则只能从单个页面计数记录。您需要使用客户端处理模式来访问服务器上的所有数据或计数记录。
table_01 = $('#table_01').DataTable( {
    dom: "Blfrtip",
    ajax: {
          url: "source_01.php",
          type: "POST",
          data: function (d) { 
                    d.selectUserID = userID;                         
                    } },
    serverSide: true,
    processing: true,
    columns: [
        { data: "name" },
        { data: "id" },
        { data: "user_id", visible: false },
        { data: "count" ,
            "render": function () {
                var json = table_02.ajax.json().data;                   
                return json.length; 
            }               
        }                              
    ],
    ...