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

How can i use Bootstrap "data-toogle" instead of a standard checkbox in the Editor?

$
0
0

How can i use Bootstrap "data-toogle" instead of a standard checkbox in the Editor?

I tried with:
....{
label: "Status ",
name: "mit_status",
type: "checkbox",
display: function(mit_status) {
return '<input type="checkbox" name="' + editor.mit_status + '" checked data-bootstrap-switch data-off-color="danger" data-on-color="success">';
},
options: [
"aktiv"
],....


How send data row from data table js to flask and delete it

$
0
0

i have issue to send data in flask from js. I try use ajax. I have data table in website, need make delete function then i press button delete that row.

js code

   $('#calEvents').on( 'click', 'button', function () {
   var data = table.row( $(this).parents('tr') ).data();
   var row= this.parentNode.parentNode;
   alert(row.rowIndex);
  
   var confirmalert = confirm("Are you sure?");
   if (confirmalert == true) {
      document.getElementById("calEvents").deleteRow(row.rowIndex);

      new_item = $('#data').val() //value I want to send 
      $.ajax({ 
          url: '/delete_value', 
          type: 'POST', 
          data: new_item,
          success: function(response){ 
              $('#main').text(response) 
          } 
      })   
          }else{
        alert('Invalid ID.');
          }
 });

Python code

@api.route('/delete_value', methods=['POST'])
@login_required
def get_javascript_data(new_item):
    new_item = request.get_data()
    query = "DELETE FROM CalEvents WHERE eventId = 1"
    app.logger.debug(query)
    cursor.execute(query)
    return redirect(url_for('calendar/get'))

if u got some tips or tricks please tell me.

Missing duplicate rows in result of Mjoin

$
0
0

Hello, I was trying to perform a mjoin as below. But after checking, I found the result only keeps unique rows. All duplicate rows are not shown. Would someone please have a look and give a hand? Thanks!

// get actual material used for each tank
->join(
Mjoin::inst( 'maconsumption' )
->link( 'vessel_tanks_project.vessel_tank_id', 'daily_inspection.tank_id' )
->where('vessel_tanks_project.project_id', $project_id)
->where('daily_inspection.project_id', $project_id)
->link( 'daily_inspection.di_id', 'maconsumption.di_id' )
->fields(
Field::inst( 'size_id' ),
Field::inst( 'quantity' )
)
)

Empty field in Editor field type "select"

$
0
0

Hi all,

I implemented a field of type "select" in my Editor instance which works very well.
I also used a placeholder to give the user the opportunity to not directly select one of the options.

Now my question:
I want to give the user to opportunity to select one option but deselect it as well in within the same instance.
But in my case I can select one option but afterwards I am not able to select the placeholder again.

If I enter a empty option into my options, the placeholder isn't visible anymore.

Does anyone have a good solution for this?

            {
                "label": "Test:",
                "name": "Test",
                "type": "select",
                "multiple": true,
                "separator": ", ",
                "placeholder": "Please choose",
                "options": [
                    '',
                    '1',
                    '2',
                    '3',
                    '4',
                    '5',
                    '6Cleaning'
                ]
            },

Thanks in advance!

Daniel

DataTables Not Fully Working Correctly with ASP.NET GridView Paging (only searches current page)

$
0
0

I have an ASP.NET GridView with the following setup:
1. Sorting is implemented using ASP.NET GridView's Sorting (OnSorting="gridList_Sorting")
2. Paging is implemented using ASP.NET GridView's Paging (OnPageIndexChanging="gridList_PageIndexChanging")
3. Searching/Filtering is implemented using JQuery DataTables

Background: The setup is that way because the GridView needs to be editable. I tried implementing sorting, paging, and searching/filtering exclusively using DataTables but I get the issue of the row-being-edited jumping unpredictably within the GridView (the row's position changes when it's clicked to be edited), and I wasn't able to solve it.

Going back, the issue is DataTables is only able to filter if the record occurs in the current GridView page. Example: In the edited image below, searching for "Fiona Green" will not display the filtered results. However, searching for "Hope" will display the filtered results.

Due to a tight time constraint, I need to maintain the setup (sorting and paging is done by ASP.NET GridView while searching/filtering is done by JQuery DataTables). I hope someone can help advise on troubleshooting and solving this issue. Advanced thanks!!!

How to pre-select a row in a custom searchpane?

$
0
0

I would like to pre-select a row in one of my custom panes in my searchPanes. Is there any way to do this?

Here is a cut-down version of my searchPanes definition:

searchPanes:{
    layout: 'columns-4',
    dtOpts:{
        searching: false,
        ordering: false
    },
    orderable: false,
    panes: [
        {
            header:'Availability',
            options:[
                {
                    label:'Available, 100%',
                    value: function(rowData, rowIdx){
                        return rowData[availcolumn] === 'Available';
                    }
                },
                {
                    label:'Unavailable, 0%',
                    value: function(rowData, rowIdx){
                        return rowData[availcolumn] === 'Unavailable';
                    }
                }
            ]
        }
    ]
}

And here are my columnDefs. I do have class="availability" in the thead th cell of my Availability column. The preSelect section does not pre-select the row.

columnDefs:[
    {
        searchPanes:{
            show: false,
        },
        targets: '_all',
    },
    {
        searchPanes:{
            show: true,
        },
        targets: 'searchpane',
    },
    {
        searchPanes:{
            preSelect:['Available, 100%']
        },
        targets: '.availability'
    }
]

Header row not scrolling?

$
0
0

I'm having some basic difficulties (using current version) (and I am using this for the first time, so I'm sure I'm doing something unintentionally wrong).

So, I started by building the buddle of features I wanted. I wanted to be able to freeze the header and the first two columns, so I included those and a few other features I thought would be useful once I got going.

Anyway, when I got my first example up and running, I noticed that the header looked good, but all the rows scrolled horizontally under it (which seemed totally wrong; at least NOT what I was expecting with lockedColumns! ;-) )

Anyway, is this a known thing? I wasn't able to get locked or rows or columns to work for me at all...

How to prevent columns visibility state when adding new columns ?

$
0
0

Hello,

Thank you for all the work you put in that project !

We let our user choose which columns they can show or hide with the colvis plugin. But we add or remove columns a lot and each time we do, every user need to configure again which column he want to hide. Is there a way to prevent that reset ?


Parent / child editing: Parent table needs to show child table information

$
0
0

Hello!

I made a parent / child solution based on this example:
https://editor.datatables.net/examples/advanced/parentChild.html

The parent table shows the order projects, the child shows the elements of the choosen order.
Each element has price and quantity.
How can I show the summarized price of elements on the parant table?

ajax:
{
    url: 'ajax/pr1.php',
    type: "POST"
}
    $editor = Editor::inst( $db, 'pr', 'id' )
    ->fields(
...
);
$editor->process( $_POST );
$editor->json();

Thank You and best regards:
Endre, Szak

Having trouble with desktop formatting on responsive tables

Wordpress intergration

$
0
0

I have successfully implemented a number of datatable/editors on a wordpress site I personally host. Datatables is an excellent and powerful app!

However, I can't get the posted tables to reflect the dt CSS. I'm guessing the Wordpress style sheets are causing a conflict. Just wondering if anyone has found an easy solution to the problem

Thanks

styling column().header()

$
0
0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

How can I use the same styling which i use for original "thead th" after I dynimcally change the heading name
$( table2.column(3).header()).text( 'new text' );
I want 'new text' to have the same styling as used in the earlier table heading (<th class="rotate">

Product Name

</th> )

in this case, PRODUCT NAME is changed to NEW TEXT and I want 'new text' to inherit styling properties of 'PRODUCT NAME'

Get column type in ".refglobaloptions.OptionType;

$
0
0

I would like to get the column type of a field in the preOpen event so that I can cancel editing on certain columns.

I am using Keys but I don't want to limit the user's ability to move around in the table.

The following code works but I suspect I am not using the correct API.

editor.on('preOpen', function (e, mode, action) {
  var column = editor.field($editor.modifier().column);
  // This works but I suspect I am not using the proper API.
  var columnType = column.s.opts.type;
  if (columnType == 'readonly')
    return false;
});

How to add Counter Column in my tablepress plugin

$
0
0

I might be repeating this question. I want to create 500 rows and numbering them would be a headache. So I search for any automatic way. So I end up here. But still not understand how do I implement Counter Column in my TablePress plugin - https://datatables.net/examples/api/counter_columns.html.

Note: I'm not expert in code stuff

Add className or Id to columns in Datatable

$
0
0

var topTable = $('#topTable').DataTable();

dataResult.map((eachData,index) => {
topTable.row.add([ eachData.id, eachData.name, eachData.dep])
}

topTable.draw()

I want to add classname or id class="name-"+index to the columns, such that

tr
td
td(class="name-0) name
td
tr
td
td(class="name-1)
td


Inlineedit stops working aftfer editing 1st field

$
0
0

Hello,

on https://customer.vogeler-ag.de/obi/intranet/test/test2 a testing page can be found. It displays the calendar weeks of a year. You can click on a cell and change the color of this cell from a dropdown on clicking on another area >>without<< a cell (e.g. white background) at the page.

But when you click on another cell for bluring, the editing is not possible: you can select color and the page stops working on the blur-event. The dropdown from the first cell is still shown and the 2nd clicked cell-editor is opened again.

can anyone help?

best regards

Volkhard

How to get updated data without redrawing a table

$
0
0

Hi,

I'm using DT with AJAX cal like:

ajax: {
url :'data.php', // json datasource
type: 'post', // method , by default get
data: function ( d ) {
d.act = 'ajax-get-data';
d.range = '90';
},
},

everything is OK.

After I can use ajax.reload() for data refreshing... But for some cases I need new updated data before draw() and populate the table row-by-row with additional manipulations. Do we have a feature how to get that data from server into array without other movings? I can make it using separate custom ajax call but I have to gather and send all the data like pages, sorting, search etc. (((

https://datatables.net/blog/2019-01-11 jsbin?

$
0
0

Is there a jsbin I can clone, or can you create a jsbin I can clone, which implements https://datatables.net/blog/2019-01-11?

I'm not sure where to find the files which are loaded under the blog via /media/blog/2016-03-25/xxx. I don't think the files mentioned under https://datatables.net/manual/tech-notes/9 are sufficient to implement this child table behavior.

I'm having some trouble with some similar code, and I want to start fiddling with a known working example.

thanks

Datatables always shows 1 Less column than in data source

$
0
0

I have searched this forum and stack and attempted many things but cannot come up with a solution.

I have 6 columns to display in a datatable. The datatable will show 5 of those 6 but never all 6.

If I drop off one column from my data source and table, the grid will then show 4 of 5, drop it down to 4 the grid will show 3 of 4. If make the screen small to show a responsive view and then fresh all the fields will show up on that resized view, but never on a full page. **It short the grid will Always Display 1 Less than what is in the source **(unless I use the sized down mobile view) see screen shots.

The page is more than wide enough for all columns to show. Any help would be appreciated.

loadDataTable: function (dataSet) {

        var dataObject = JSON.parse(dataSet);
        utils.log(dataObject);

        rewardsDataTable = $('#masterNodeTable').DataTable({        
            "columnDefs": [
                { "width": "10px", "targets": 0 },
                { "width": "45px", "targets": 1 },
                { "width": "15px", "targets": 2 },
                { "width": "35px", "targets": 3 },
                { "width": "35px", "targets": 4 },
                { "width": "35px", "targets": 5 }
            ],
            "data": dataObject,
            "responsive": true,   
            "paging": true,
            "lengthMenu": [[6, 10, 25, -1], [6, 10, 25, "All"]],
            "pageLength": 6,             
            "columns": [
                { "data": "Rank" },
                { "data": "Payee" },
               { "data": "IpAddress" },         
                { "data": "ActiveDays" },                 
                {
                    "data": "CountryFlagUrl",
                    type: 'html',
                    render: function (data, type, row) {
                        return data ? '<img height="15px" width="15px" src="' + data + '"/>' + ' ' + row['CountryName'] + ', ' + row['RegionName'] : '';
                    }
                },         
                {
                    data: 'LastSeenUnix',
                    type: 'html',
                    render: function (data, type, row) {
                        return data ? utils.formatUnixDate(data) : '';
                    }
                }
            ]
        });
    }

How to submit a functional Editor test case

$
0
0

Link to test case:
http://live.datatables.net/quhacego/1/edit

Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

I would like to submit a bug report but it can only be shown using a full edit cycle.

I started an example but could not find a way to point to a live data source for data retrieval and edit.
I saw the links as the bottom of this announcement but they did not work as expected.
https://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read#latest

I used the inline editor as the starting point for my example.

https://editor.datatables.net/examples/inline-editing/simple.html

I attempted multiple data URLs:
1) Pointing to the URL used by the main site triggers a CORS error,
2) Using the URLs in the downloaded examples also fails

Viewing all 82690 articles
Browse latest View live


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