Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all 82367 articles
Browse latest View live

I have created subgrid for each row, however pagination of subgrid is not working

$
0
0

code for show or hide subgrid

$('#exampleEditor tbody').on('click', 'td.details-control', function () {

            var tr = $j(this).closest('tr');
            var row = editorTable.row( tr );


            if ( row.child.isShown() ) {
                // This row is already open - close it
                row.child.hide();
                tr.removeClass('shown');
                $j("#subgrid"+(row.data().column1).trim()).DataTable().destroy(false);

                $j("#subgrid"+(row.data().column1).trim()).css("display","none");
            }
            else {
                // Open this row
               format(row,tr,(row.data().column1).trim());
            }

        } );

code to create subgrid

function format ( row, tr,index ) {

        if($("#subgrid"+index).length == 0)
        {
            $("body").append(getTable(index));
        }

        subgridTable = $("#subgrid"+index).DataTable({
            "processing": true,
            "serverSide": true,
            "orderMulti": true,
            "ajax": "serverURL",
            "columns": [
                { "data": "ordernumber","width": "10%"},
                { "data": "part","width": "2%" },
                { "data": "quantity","width": "1%" },
                { "data": "duedate","width": "2%" },
                { "data": "datebinstart","width": "37%" },
                { "data": "shiftbinstart","width": "46%" },
                { "data": "weekbinstart","width": "28%" }
            ],
            "columnDefs":[
                {
                    "targets": [ 4,5,6 ],
                    "visible": false
                }],

            initComplete: function(){

              //Code to hide subgrid html table till response is arrived
                $("#subgrid"+index+"_wrapper").css("display","none");
                $("#subgrid"+index).css("display","");

               //need to use set timeout function as the response takes some time
                setTimeout(function(){ row.child( $j("#subgrid"+index+"_wrapper").html()) .show();
                    tr.addClass('shown'); }, 3000);

            }
        });

    }

    function getTable(index)
    {
        return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;" id="subgrid'+index+'">'+
            '<thead>'+
            '<tr>'+
            '<th>Order Number</th>'+
            '<th>Part</th>'+
            '<th>Quantity</th>'+
            '<th>Due Date</th>'+
            '<th>datebinstart</th>'+
            '<th>shiftbinstart</th>'+
            '<th>weekbinstart</th>'+
            '</tr>'+
            '</thead>'+
            '</table>';
    }

Disable update all field

$
0
0

Hello, i use a database view, i have a problem when i edit a field, if i use inline editor (edit only one field in table) problem is not present, if i click on EDIT button and edit field in popup windows, i have error to update a field because is not editable, how can solve?

How to use required validation on editor.dependent (show) function

$
0
0

HI,
I am new to Datatables and have spent a couple of days trying to find the solution without making any head way. So please forgive me if this is a newbie question.

In the insert\edit function i have 2 fields that only appears when one specific value on other field is selected:

editor.dependent( 'p2b_users.naccessusers', function ( val ) {
return val === '1' ?
{ show: ['p2b_users.supervisor_id','p2b_users.sfid'] } :
{ hide: [] }; } );

I´m trying to use the required\notEmpty function, but if i use this way i'm not allowed to submit the form even without triggering the editor.dependent (show) event.

Field::inst( 'p2b_users.sfid' )
->validator( Validate::required() )
->validator( Validate::numeric() )
->validator( Validate::unique(ValidateOptions::inst()
->message('SFID já atribuído.')
))

Is it possible to use the required validator ONLY if those fields where visible triggered by the editor.dependent (show) event?

Can someone help me please?
Thank you very much.

Default Value in Editor

$
0
0

I need to have the ID from table 1 as a default value for the editor field that will save into table 2. This is what I have but it is not working.

  $(document).ready(function() {
        var editor = new $.fn.dataTable.Editor({
            ajax: 'php/table.query.php',
            table: '#sku_request',
            fields: [{
                    label: "Note:",
                    name: "dpe_notes.note"
                },

                {
                    label: "Your Name:",
                    name: "dpe_notes.user"
                },
                {
                label: "Note ID:",
                name: "dpe_notes.note_id",
                def: function (data, type, full, meta, row) { return data.ID; }
            },




            ]
        });

The Note ID is what I need as the default from the table. The note ID is the ID from table 1.

My full script

(function($) {

    $(document).ready(function() {
        var editor = new $.fn.dataTable.Editor({
            ajax: 'php/table.sku_request.php',
            table: '#sku_request',
            fields: [{
                    label: "Note:",
                    name: "dpe_notes.note"
                },

                {
                    label: "Your Name:",
                    name: "dpe_notes.user"
                },
                {
                label: "Note ID:",
                name: "dpe_notes.note_id",
                def: function (data, type, full, meta, row) { return full.dp_expected.note_id; }
            },




            ]
        });

    $(document).ready( function () {
  var table = $('#sku_request').DataTable({
        ajax: 'php/table.sku_request.php',
        dom: 'Bfrtip',
        select: true,
        pageLength: 10,
        lengthChange: true,
        scrollX: true,

        language: {
                searchPanes: {
                        clearMessage: 'Clear All',
                        collapse: 'Filter',
                        cascadePanes: true,
                        viewTotal: true,
                        layout: 'columns-2',
                        dataLength: true

                }
        },
        buttons: [
                {
                        extend: "remove",
                        text: "Delete",
                        editor: editor
                },

                {
                        extend: "excelHtml5",
                        text: "Excel"
                },
        {
            extend: "edit",
            text: "Update",
            editor: editor
        },


        ],


        columns: [

      {
          data: "dp_expected.ID"
      },
      {
          data: "dp_expected.Invoice_"
      },
      {
          data: "dp_expected.District"
      },
      {
          data: "dp_expected.Sold_By"
      },
      {
        data: null,
        render: function ( data, type, full, meta, row ) {
                // Combine the first and last names into a single table field
              if(full.dpe_notes.note >= 0){
                return 'No Notes';
              }else {

                  return full.dpe_notes.note+' - '+full.dpe_notes.user;
              }

            } },
        ],
  });
} );


    });

}(jQuery));

How to keep current page when refreshing grid with pipeline?

$
0
0

I use pipeline to cache 5 pages on my grids: https://datatables.net/examples/server_side/pipeline.html

When user edits record on a modal dialog, I refresh the grid using: $('.grid').DataTable().clearPipeline().draw();

But that makes the grid go back to page 1. Is there a way to fetch records from server with pipeline but keep current page?

Cascading lists in Editor: please explain

$
0
0

Hello! I recently started studying DataTables. Stopped with dependent fields. I looked at a lot of examples and still a lot is unclear.

There is a classic example:
https://datatables.net/blog/2017-09-01

It is often pointed at. And it is important for me to understand.
It would be nice to decipher it a bit:
1. I don't understand: how many tables are there in the Database? As far as I understand 4:
Table 1- for filling in
Table 2 - " Continents»
Table 3 - " Countries»
Table 4 – " id_Сontinent-id_ Country»
2. I really want to see the "JavaScript" code
3. editor.dependent ('continent', '/ api/countries' );
the Second argument «/ api/countries» what is it?
4. Do I understand correctly that in this example there are actually two Server script (PHP files)? I'd like to see both.
I'm sorry, I'm still at the beginner level and I need your help.

Editor PHP Full Join

$
0
0

Hello,

Is there any way to do 'full join' in Editor PHP..? It looks like I can only do left join at the moment...

DataTable and inline Editor without database

$
0
0

Hi guys,

I have a situation where I have a Data Table that is filled with data from a web service without any database on our end.

Data loads fine into the DataTable via AJAX and the data comes in formatted correctly. But I'm having a problem implementing the Editor. When I click on a cell the editor comes up. I can edit the field but then nothing happens. If I click somewhere else on the page the editor field closes but the table is not updated. Also the editor now no longer responds to clicks on any cells. No errors are reported in the console.

I'm using local storage for the data based on what I have found in examples and forum posts. This is the editor Editor code I have:



function setupEditor() { editor = new jQuery.fn.dataTable.Editor({ table: '#task-and-po-table', fields: [ {"label": "Job", "name": "JOBNUM"}, {"label": "Vendor", "name": "VENDORNUMBER"}, {"label": "Name", "name": "VENDORNAME"}, {"label": "Task Num", "name": "SEQUENCE"}, {"label": "Start Date", "name": "STARTDATE"}, {"label": "End Date", "name": "ENDDATE"}, ], ajax: function ( method, url, d, successCallback, errorCallback ) { console.log('Editor . Ajax'); var output = { data: [] }; if ( d.action === 'edit' ) { jQuery.each( d.data, function (id, value) { value.DT_RowId = id; jQuery.extend( combinedList[ id ], value ); output.data.push( combinedList[ id ] ); } ); } localStorage.setItem( 'combinedList', JSON.stringify(combinedList) ); successCallback( output ); } }); // Activate an inline edit on click of a table cell jQuery('#task-and-po-table').on('click', 'tbody td:not(:first-child)', function (e) { console.log('editor.inline'); editor.inline(this); }); }

Even though the editor doesn't activate, the console.log in the click executes.

I will probably go with setting up a SQL table for this and see if I can make that work. But I really would like to understand where I'm going wrong. I'm missing something. I just noticed that the console.log('Editor . Ajax') never shows up...

Thanks in advance for any advice!


How to prevent datatable from scrolling to the top during scroll?

$
0
0

I have a datatable with a scroller that I am using to support a large amount of data. Everytime I try to scroll to see the rest of the data the scrollbar jumps back up to the top. Also I noticed when I start to scroll my ajax function gets called a bunch of times and wont stop being called! Has anyone encountered this issue?

SearchPanes, Is there a way to know which columns is a searchpane related.

$
0
0

I'm implementing a feature for my website and I need to get the column that the search pane is applying its search/filter...
I've tried a lot of things but haven't found an easy way to get the column from a searchpane... or the other way around, get the searchpane using the column, I think that this may also work for what I need to achieve.

I think this may be troublesome for the custom panes, but in this case I don't have any, what I do have is that the panes are active for certain columns...

But what I really need is that get the column of certain pane, or the pane that belongs to certain column.

Read id25: Bet On Sports And Make It More Interesting

$
0
0

As voice-based searches are driving type-based mostly queries out of the arena, it is obvious that we should make more of voice search optimized content to keep up with the development. In this sport, they could make their dream come true. They won't ever lay bet with money that is needed for other necessary things like family bills, only using cash that is set aside purely for his or her lay betting actions.

We will divide these games into broad classes resembling careers, action, technique and adventure. How have they performed within the last video games?
<a href="https://krishnaferro.co.in/casino-bonuses/">https://krishnaferro.co.in/casino-bonuses/</a
Our results also recommend that widely documented inefficiencies in this market are likely to dissipate over time. This internet betting site additionally affords you several other options that aren't common amongst most sport betting websites and these embody 100% low cost bonus, online dwell assist and a lot more as well. <a href='https://jobsalerthub.in/online-casino-india-tips-offers-and-bonuses/'>https://krishnaferro.co.in/casino-bonuses/</a
The beginners who are allowed to dive up to a limited depth often put on uncomplicated it's gear or free plunge. It improves reminiscence: It's a well-known undeniable fact that playing card game like rummy improves your memory.
<a href="https://jrfoods.in">https://krishnaferro.co.in/casino-bonuses/</a
Some laying companies speak about how they only go in for the excessive priced horses, how their service is not for the faint hearted. There are tons and tons of experts on the market and discovering the appropriate one to follow even should you have no idea anything about sports activities is a Must.

The news that Guardiola was to take over the B team was a mere footnote: no one thought of him as a candidate to take over the first crew, not for an excellent few years at the least. Racing sport is nothing but the game which is performed to competing the other player from one degree to a different in brief time period.

Accuracy is of paramount significance when determining the likelihood issue, so as to maximise the probabilities of winning consistently. Once enabled, just say one thing like "Alexa, tune to Fox" to look at the Super Bowl.

Post58: Horse Games' Incredible Game Catalogues Exciting Choices Of Wonderful Games - Online Gaming

$
0
0

Many people do not realise that the Australian Football results are quite completely different to UK and European results. Although you don't should be an skilled on the particular sort of sports activities you're betting, it is however necessary to be accustomed to how betting on sports is finished. This may little question mean you lose a tiny amount of money, but you'll make yourself elligible for the money bonus (aslong as you've met the certain standards).

The mix of topic, platform and the lack of live sports turned ‘The Last Dance’ right into a cultural touchstone on the same scale as ‘Game Of Thrones.’ Johnson and XTR had already been discussing and planning the Johnson film, but the curiosity has positively grown for the reason that Jordan doc’s incredible success. I continued my search and found a very attention-grabbing concept which uses matched betting to offer a "threat free" wager where it would not matter if there is a successful or shedding participant/group, the wager will always win.
<a href="https://jobsalerthub.in/play-online-slot-machines-from-india/">https://jobsalerthub.in/play-online-slot-machines-from-india/</a
In the event that they really had one thing so special why on earth would they give it out? One may also wager on the entire number of yellow or purple playing cards to be issued during the match combined. <a href='https://lloydsfinance.in/best-variety-of-online-port-gaming-in-india/'>https://jobsalerthub.in/play-online-slot-machines-from-india/</a
These include The Ajman Palace, Coral Hotels & Resorts, Corp Executive Hotels, ECOS Hotels and EWA Hotel Apartments. Those with some hockey sense can usually work out who is going to come out forward spherical by spherical in the playoffs, so betting on series is better than betting on particular person video games.
<a href='https://lloydsfinance.in/'>https://jobsalerthub.in/play-online-slot-machines-from-india/</a
Additionally, a descriptive internet site can even find it's path to the topmost. Yes, due to some savvy promoters, our favorite's game is being given a makeover of kinds, in an try and open up it as much as a wider audience.

You can most likely discover these firms listed on the cashback websites which are linked to from this webpage, and at the underside of this text. The primary thing is that we don’t cease believing and creating as mankind is so good at exploring the wonders of artwork and what it will probably offer.

Newcastle will likely be the one meeting on Monday, there shall be two conferences for the next four days with three on Saturday, June 6. That is the date of the Qipco 2,000 Guineas at Newmarket with the 1,000 Guineas 24 hours later. The guy reveals you how he maintained a win strike charge of 89.52% and a spot strike fee of 96.35% using his personal betting system.

csvHtml5 custom export not working properly

$
0
0

Hi,

I have a problem with the customize function for the csv export.

Actually I have a page on my website where you can specify the csv export config (date format, decimal format, field separator, field boundary, etc.), so first I retreive this data, then I process the default csv string to match my config, by changing the field separator etc.

The processing works well, my custom csv is properly formatted.

Here is the code I use for the buttons :

buttons: [
    {
        extend: 'csv',
        filename: 'datatables_csv',
        customize: async function(csv)
        {
            const customCSV = await defaultCSVBuilder(csv);

            console.log(customCSV);

            return customCSV;
        }
    }
]

As you can see I pass the default csv string to my custom csv builder to make some processing. Howerver when I open the downloaded csv, the content is : [object Promise]

I don't understand why despite using async / await the promise doesn't seem to resolve. So I put one await sleep(5sec) inside my custom function, before the end, and as soon as I clicked the download button, the file was downloaded, then 5 seconds later my custom csv file was displayed in the console. So it seems that customize() is not waiting for my custom function to resolve.

I don't feel like I have made a mistake but there is probably something that I don't understand, your help is welcome!

(I based my custom function on the comment on this page : https://datatables.net/reference/button/csv)

Combining searches

$
0
0

I have a use case where I'm presenting two checkboxes to a user. These checkboxes will both do different "searches" on the datatable and filter it appropriately. They look for the value of a data attribute on the <tr> element.

Individually they work fine. However I want them to chain together meaning when one is clicked, do that one and when another is clicked apply that one, along with the first one's value.

I can't get them to work together because when I toggle one off, I have to do
$.fn.dataTable.ext.search.pop();
and that removes both filters!

How can I remove the specific filter relating to just that checkbox?

Search application functions

function hidePickedRecords(){
        $.fn.dataTable.ext.search.push(
        function(settings, data, dataIndex) {
            var oTable = new $.fn.dataTable.Api( settings );  // Get API instance for table
            return $(oTable.row(dataIndex).node()).attr('data-picked-row') == 0;
        });
    }

    function hideUnReadyRecords(){
        $.fn.dataTable.ext.search.push(
        function(settings, data, dataIndex) {
            var oTable = new $.fn.dataTable.Api( settings );  // Get API instance for table
            return $(oTable.row(dataIndex).node()).attr('data-fully-ready') == 1;
        });
    }

Event listeners for the checkbox changes:

 // Hide Picked checkbox change
            $("#hide-picked-checkbox").on("change", function(){
                let showPickedRecords = $(this).is(":checked") ? 0 : 1;

                if ( showPickedRecords ) {
                    $.fn.dataTable.ext.search.pop();     // removes filter already in place
                }
                else {
                    hidePickedRecords();
                }
                oTable.draw();

            });

        // Show Un-Ready checkbox change
            $("#show-un-ready").on("change ", function(){
                let showUnReadyRecords = $(this).is(":checked") ? 1 : 0;

                if ( showUnReadyRecords ) {
                    $.fn.dataTable.ext.search.pop(); // removes any filter already in place
                }
                else {
                    hideUnReadyRecords();
                }
                oTable.draw();
            });

Article id68: Biathlon bets

$
0
0

Now, evaluation reveals that there are a variety of strange patterns of outcomes. The conversation has in all probability been echoed in conversations between trainers, jockeys, grooms and employees whose essential contribution to creating a meeting work mean they are going to be allowed again via a racecourse's gate from Monday at Newcastle. If you wish to get the details about different choices you have got at hand for profitable additional cash, the site named earlier than may also present you the lotto outcomes South Africa.

As soon as the trailing participant or workforce wins the second set, the two sides all of the sudden have even scores, though one participant or staff may need truly gained many extra factors than the opponents. They all the time it is best to attempt to make most of these cool math gamess to herald a special selection of experience so that it will the online golfers.
<A HREF="https://parimatchindia.in/bonuses/">https://parimatchindia.in/bonuses/</A
In line with the official guidelines, the match winner is the workforce which advances to the subsequent spherical, with the exception of a coin toss or a bowl out. On most coupons will probably be marked as a 1 for home, 2 for away and a 3 or X for a draw. <a href="https://casino-stars.in/popular-mistakes-when-start-betting-online/">https://parimatchindia.in/bonuses/</a
Therefore, just remember to get a racquet that feels best for you regardless of what different folks say. Handicap betting makes a contest extra even from a betting point of view, however generally presents decrease odds.

So if you’re a fan of chewy foods, you’ll get pleasure from this sinker in your bubble tea. People's toes are otherwise shaped than one another.

The objective of a Physical Education program is to show and promote in students from grades K to 12 the importance of adopting and sustaining energetic and healthy lifestyles that benefit the mind and physique. Such sites give them a chance to play sport games online without spending a dime.

It is also advisable to learn up on your players of every group that will provide help to assess which often method you want to location ones wager. If you're a leisure participant who hits balls once a week or twice a month and you don't have any intention of becoming a member of a tennis staff or being in a tournament, then there is completely no purpose as to why it's best to buy an costly racquet.


Article21: Vibori

$
0
0

PORTER, SVOR, PESTEL evaluation with the potential impact of micro-financial elements by region in the marketplace have been offered within the report. Few betting systems deliver on what they promise. Your opponent can simply see you on the internet when your strikes are created.

Some racecourses could possibly make a contribution however there's an opportunity some racecourses may have a zero govt contribution (to prize money). Usually parents are enormously concerned about the truth that their kids are spending their time and money fruitlessly.
<a href="https://casino-stars.in/parimatch-india-review/">https://casino-stars.in/parimatch-india-review/</a
From there, every workforce member performs alternate shots till the ball is holed. “Nascar has made range and inclusion a precedence and will not tolerate the type of language used by Kyle Larson during Sunday’s iRacing occasion,” the assertion said. <a href="https://parimatchindia.in/how-to-deposit-and-withdraw/">https://casino-stars.in/parimatch-india-review/</a
This means that cash may be made threat free as a result of a revenue is gained whether you "win" or "lose" so to talk. Football In working betting permits you to start your betting at any time throughout the match and wager at the appropriate time.

In the case of tottenham betting, you must know that these days there are various websites that enable you to check odds and to increase your probabilities of successful. Betting in sports activities has become one nice pastime for sports activities fans and actually, it has made sports activities much more thrilling and thrilling.

Truly speaking when you want the journey and in addition suspense in one in all a form method while taking part in the gaming online, it is best to go for MMORPG which options 3-D assist and therefore the image quality is certainly remarkable. In both league and top scorer betting, it is usually possible to bet in your workforce or participant finishing within a sure number of positions.

Various sorts of sports phone for another company or methodology of collector so build a judicial choice of as a rule the only real suitable to you individually. Oceanwood, Lansdowne, AKO Capital and Citadel all declined to remark.

[BUG] Responsive and Bootstrap 4 plus and minus circle are not displayed

$
0
0

I just download Full Datatables for Bootstrap v4

Using responsive
The circles for the + / - are not displayed.
I only see - red background (no circle)
I don't see the + at all

I will setup a Jsfiddle to show you the problem.

Basic responsive show/hide buttons not showing

$
0
0

I've been struggling to get the responsive buttons to show on my project. To take a step back I just used the example code from this page, but they are not showing:

http://outdoorgearalerts.com/responsive2.html

The columns collapse as expected, and if you click on the first row left corner it actually expands the child row. But I'm not seeing the button, and I'm not seeing the dtr-control class being assigned. What am I missing here? This seems so basic but I simply have not been able to figure it out. Tia.

Load DataTables using a View

$
0
0

I have Editor working for a mySQL single table but can't get a View to work. I couldn't figure out how to put the mySQL data into jsFiddle

I have a mySQL view:
CREATE VIEW `kpakpi_view` AS
SELECT `tblkpa`.`id` AS `id`, `tblkpa`.`kpaDesc` AS `kpaDesc`, `tblkpi`.`kpiDesc` AS `kpiDesc` FROM (tblkpa JOIN tblkpi ON ((tblkpa.id = tblkpi.kpaId_FK)))

Gives the following data:

My code to load this query into DataTables/Editor

router.all('/epms/viewkpakpi', async function (req, res) {
let editor = new Editor(db, 'kpakpi_view').fields(
new Field("kpaDesc"),
new Field("kpiDesc"),
);
await editor.process(req.body);
res.json(editor.data());
});
module.exports = router;

and

function($){

$(document).ready(function() {
var editor = new $.fn.dataTable.Editor( {
ajax: '/epms/kpakpi_view',
table: "#kpakpi",
fields: [
{
"label": "kpa:",
"name": "kpadesc"
},
{
"label": "kpi:",
"name": "kpidesc"
}
]
} );
var table = $('#kpakpi').DataTable( {
dom: 'Bfrtip',
ajax: '/epms/kpakpi_view',
columns: [
{"data": "kpadesc"},
{"data": "kpidesc"}
],
} );
} );
}(jQuery));

I receive the error message in the Chrome debugger: 404 kpakpi_view?_=1609758540366

and a popup on the screen

DataTables warning: table id=kpakpi - Ajax error. For more information about this error, please see http://datatables.net/tn/7

I have looked at http://datatables.net/tn/7 but I can't understand how it would help me.

Please help me. Thanks

Datatable Editor node.js - How to filter on an mjoined table?

$
0
0

I'm using editor with node.js. How to filter on an mjoin the joined table?

I have this mjoin:

let editor = new Editor( db, 'glossary', 'id' )
.fields(
    new Field( 'glossary.id' ),
    new Field( 'glossary.field_name' )
)    
.join(
  new Mjoin('groups')
    .link('glossary.id', 'glossary_groups.glossary_id')
    .link('groups.id', 'glossary_groups.group_id')
    .order('name asc')
    .fields(
      new Field('id')
        .options(new Options()
          .table('groups')
          .value('id')
          .label('name')
        ),
      new Field('name')
    )
)

Which renders:

data    [ {…}, {…}, {…}, … ]
    0   Object { DT_RowId: "row_51", glossary: {…}, groups: [] }
        DT_RowId    "row_51"
        glossary    Object { id: 51, … }
            id  51
            field_name  "Field Name 51"
        groups  []
    1   Object { DT_RowId: "row_226", glossary: {…}, groups: […] }
        DT_RowId    "row_226"
        glossary    Object { id: 226, … }
            id  226
            field_name  "Field Name 226"
        groups  [ {…}, {…} ]
            0   Object { id: 59, name: "Group 59", … }
            1   Object { id: 60, name: "Group 60", … }
    2   Object { DT_RowId: "row_147", glossary: {…}, groups: [] }
        DT_RowId    "row_147"
        glossary    Object { id: 147, … }
            id  147
            field_name  "Field Name 147"
        groups  []
    3   Object { DT_RowId: "row_149", glossary: {…}, groups: […] }
        DT_RowId    "row_149"
        glossary    Object { id: 149, … }
            id  149
            field_name  "Field Name 149"
        groups  [ {…} ]
            0   Object { id: 59, name: "Group 59", … }

How can I filter (OR) on the 'groups' table e.g. [ '59', '60' ]?

// getData.selectGroupID:
// [ '59', '60' ]

So result:

data    [ {…}, {…}, {…}, … ]
    1   Object { DT_RowId: "row_226", glossary: {…}, groups: […] }
        DT_RowId    "row_226"
        glossary    Object { id: 226, … }
            id  226
            field_name  "Field Name 226"
        groups  [ {…}, {…} ]
            0   Object { id: 59, name: "Group 59", … }
            1   Object { id: 60, name: "Group 60", … }
    3   Object { DT_RowId: "row_149", glossary: {…}, groups: […] }
        DT_RowId    "row_149"
        glossary    Object { id: 149, … }
            id  149
            field_name  "Field Name 149"
        groups  [ {…} ]
            0   Object { id: 59, name: "Group 59", … }

I tried:

editor.where( function () {
    this
      .orWhere( function () {
        for ( let i=0; i < getData.selectGroupID.length; i++ ){
          this.orWhere( 'groups.id', '( SELECT DISTINCT group_id FROM glossary_groups )', 'IN', false);   
        }
      })
});   

But I'm getting this error:

TypeError: The operator "( SELECT DISTINCT group_id FROM glossary_groups )" is not permitted

I also tried:

editor.where( function () {

    this
      .orWhere( function () {
        for ( let i=0; i < getData.selectGroupID.length; i++ ){
          //this.orWhere( 'groups.id', getData.selectGroupID[i] );
          //this.orWhere( 'groups.id', 'SELECT DISTINCT group_id FROM glossary_groups', '=', getData.selectGroupID[i] );
          //this.orWhere( 'glossary.id', '=', 51 );
          //this.orWhere( 'glossary.id', '( SELECT DISTINCT group_id FROM glossary_groups )', 'IN', [[59, 60]] );
          //this.orWhere( 'glossary.id', '( SELECT DISTINCT glossary_id FROM glossary_groups )', 'IN', false);        
        }
      })

});  

On this post they suggest a raw select distinct:

https://datatables.net/forums/discussion/comment/178893#Comment_178893

//check whether the respective user has any permission
    ->where( function($q) {
        $q  ->where( 'users.id', 
               '( SELECT DISTINCT user_id   
                    FROM user_permission
                  )', 'IN', false);

and I think this is a https://editor.datatables.net/manual/php/conditions#Sub-selects

But how to perform the same logic with node.js? https://editor.datatables.net/manual/nodejs/conditions

Viewing all 82367 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>