Como eliminar una fila de una datatable

mi pregunta es, como puedo hacer para eliminar la primera fila de un datatable por medio de un botón (fuera de la tabla)
me metí a ver ejemplos en la pagina de datatable pero no me funciona.
Muchas gracias

    


    
Name Position Office Age Start date Salary
Tiger Nixon System Architect Edinburgh 61 2011/04/25 $320,800
Cedric Kelly Senior Javascript Developer Edinburgh 22 2012/03/29 $433,060
Name Position Office Age Start date Salary

Help with working with lightning:dataTable?

I’ve been experimenting with lightning:dataTable and have some issues — not sure if they’re bugs or simply user error. I’ve spotted lots of issues with setting up the columns. I have a table with 3 columns: name, date, amount.
dataTable screenshot

  1. The columns default to equal size, which results in an amount column 1/3 the with of my browser (or the container I put it in), with the AMOUNT title flush left, and the column of amount figures flush right. Looks bad. I tried using the initialWidth… after some trial and error discovered you have use an integer initialWidth:100 not a string initialWidth:"100". No real question here, just took me a while to figure out and thought others might save some time by reading.

  2. The payment date is wrong — it’s deducting a day. I did a console.log to check the input data, which is correct, so I believe it’s only in the displaying of the data that the day gets deducted. Weird. If I use type:'date-local' in the column definition, it displays the correct date, but not in the formatting I need.

@sfdcfox has me thinking about timezone… I think that’s the answer. When I SOQL the data, it includes a date (no time) so the controller returns a date at midnight GMT… which is one day ahead of date-local in Pacific time.

  1. I’ve set up the columns to be sortable, and wired it up. It works, except… it sorts the Amount column as if it’s a string. So $15.00 comes before $2.00. I’m using the “built-in” sorting (javascript, not apex), with the code provided in the docs. (Though they fail to mention you need to set up aura:attributes for sortedBy and sortedDirection in your component.) Also loading the initial data just as shown in the docs, which works fine.

It’s frustrating that inline editing doesn’t support date type. I suppose it will be coming the future when they set up the date picker for it.

Any idea what could be going on with the date or the amount sorting?

UPDATE: not sure what I did, but it’s working now. Here’s the code in case anybody’s interested…

COMPONENT


    
    
    
    
    
    
    

    

CONTROLLER

    init: function (cmp, event, helper) {
        cmp.set('v.payColumns', [
            {label: 'Project', initialWidth:280, fieldName: 'ProjectName', type: 'text', sortable:true},
            {label: 'Amount', initialWidth:120, fieldName: 'Amount__c', sortable:true, type: 'currency',cellAttributes: { alignment: 'center' }, typeAttributes: {currencyCode: 'USD'}},
            {label: 'Payment Date', fieldName: 'Payment_Date__c',  type: 'date-local', sortable:true},
            {label: '', type: 'button', initialWidth: 50, typeAttributes:
                { label: { fieldName: 'actionLabel'},variant:"base", title: 'Edit', name: 'edit_payment', iconName: 'action:edit'}},
            {label: '', type: 'button', initialWidth: 50, typeAttributes:
                { label: { fieldName: 'actionLabel'},variant:"base", title: 'Delete', name: 'delete_payment', iconName: 'action:delete'}}
        ]);
    },

// Client-side controller called by the onsort event handler
    updateColumnSorting: function (cmp, event, helper) {
        var fieldName = event.getParam('fieldName');
        var sortDirection = event.getParam('sortDirection');
        // assign the latest attribute with the sorted column fieldName and sorted direction
        cmp.set("v.sortedBy", fieldName);
        cmp.set("v.sortedDirection", sortDirection);
        helper.sortData(cmp, fieldName, sortDirection);
    },

    handleRowAction: function (cmp, event, helper) 
    {
        var action = event.getParam('action');
        var row = event.getParam('row');
        cmp.set("v.paymentId", row.Id);
        cmp.set("v.ContactId", row.Contact__c );
        // console.log("paymentId: " + cmp.get("v.paymentId"));
        // console.log('action: ' + action.name + ' | ' + 'row: ' + JSON.stringify(row));
        switch (action.name) {
            case 'delete_payment':
                cmp.set("v.projectName", row.ProjectName);
                cmp.set("v.deleteActive", true);
                break;
            case 'edit_payment': 
                cmp.set("v.editActive", true);
                break;
        };
    },

Reporte ASP.NET C# Datatable

necesito crear un reporte que sea alimentado con un datatable.

Actualmente mi proyecto muestra una grid de balance general que se alimenta desde un public static datatable que se trabajó en una clase en el código behind de C#.

Éste datatable ó tabla contiene los datos ya formateados, o sea el orden apropiado e interlineado necesarios con el nombre del insciso, las trae como que si las hubiera hecho en excel (sin colores ni negrita ni nada de eso claro está, solo el interlineado me refiero). Es por ende que no se me quita la idea que sería maravilloso encontrar un componente en el reporte como: un table grid que yo pueda alimentar con éste datatable estático de C# porque no tendría que preocuparme de nada más que por las negritas.

No sé si es posible, o estoy en un error.

Al final que si consulto nuevamente la base de datos tendría otra vez que tomar el tiempo para crear las lineas una por una porque todas difieren. y tendría que volver a consultar a la BD.

Ej.

Balance general:

Activos circulantes #
1- #
2- #
3- #
Activos no circulantes #
1- #
2- #
3- #
4- #
Total Activos #

Y así sucesivamente hasta terminar la lista.

La cosulta inicial que está en un método de la applicación solo consulta algunos cambos de la BD y muchos otros son calculados con formulas apra así formar la tabla oficial.

adjunto el modelo de estructura que se desea. Espero no haya confundido.

Excel Aquí

Ojo, el reporte no es exportarlo a excel, debería ser en un report viewer y luego imprimirlo.

Populating Datatable text field filter with value selected from HTML Form WP drop-down onkeyup in SPO

QUESTION
Is it possible to populate a datatable’s text field with the value selected in an HTML From WP using onkeyup?

DESIRED OUTCOME
Upon selecting a value from the dropdown menu in an HTML Form WP using an onkeyup action, I would like that value to be automagically passed to the text field of a datatable, prompting that datatable’s results to be filtered by the value in the HTML Form WP.

INFO
I have both an HTML Form WP and a Script Editor WP on my page.

  1. The HTML Form WP serves as a filter. When the user begins typing the name of a Country into the text field, matching results from the list:‘Countries’ begin to populate. When the user selects a country/item from the autocomplete list, the filter value is set onkeyup

    • sync: function occurring when the user selects a Country Name from ‘tags’
    • tags: text field for the HTML Form WP with autocomplete
  2. The Script Editor contains a datatable with a textbox and a button. When the button is pushed, the HTML Form WP filter value (name of a Country) is passed to the text field the datatable, and the datatable list is populated with Major Cities found in that Country, based on another list called ‘MajorCities’

    • btnShowInfo: datatable button, when pressed populates MyCountries with tags
    • MyCountries: text field for the datatable pulling from the SPO list ‘MajorCities’
    • LoadMajorCities: function that is triggered after btnShowInfo is clicked

SCRIPT
This is the script in the HTML Form WP…

This is the script in the Datatable…

Thanks in advance!

lightning:datatable component cutting off actions drop down menu when it goes past the card and displays…

enter image description hereI am having a problem using the lightning:datatable component that is contained in a lightning:card component. The actions on the table rows are getting cut off if it expands beyond the card instead of overlaying like it does for out of the box related list components. Any help or suggestions appreciated. Thanks.

PROBLEMA DATATABLE laravel

Eh tratado de agregar una data table que muchos han agregado, he seguido tutoriales pero no me da el formato default (con search y demás) como demuestra la “IMAGEN 2”.
A mi me queda como la “IMAGEN 1” y nose por que, lo que necesito que me genere el “SEARCH” ya que es como un filtro que tiene por default y la paginacion, si alguien sabe por que queda así, me ayudaría por favor!!!

ADJUNTO CODIGO

HTML

@extends('admin.layoutADMIN')

@section('content')






    






							
											@foreach ($insumos as $insumos )
											
											@endforeach
											
ID NOMBRE CATEGORIA VALOR UNIDAD DE MEDIDA FECHA DE CREACION
{{$insumos->id}} {{$insumos->nombreI}} {{$insumos->categoriaI}} {{$insumos->valorI}} {{$insumos->UmedidaI}} {{$insumos->created_at}}
@stop

CONTROLLER

    function viewaddinsumo() 
    {   

       
        $insumos =  Insumos::all();
        return view('Insumos.verInsumos', compact('insumos'));
    }

IMAGEN 1
introducir la descripción de la imagen aquí

IMAGEN 2
introducir la descripción de la imagen aquí

Search DataTable by column for a specific row

I would like to know if there are ways to make this run faster. Not a big concern right now, but I would like to think long term, it might be important.

This is C#, and I can not change the input parameters data types, but basically I have to make something like the SQL: SELECT returnCol FROM dt WHERE ColName = ColValue

As the datatable itself: it has more than 100 columns, but it should not too many rows, usually ~10 rows but it can spike up to 100 rows sometimes. This is part of a data parse that is happening once a minute, that is why I am trying to see if there are ways for enhancement.

private string FindInT(DataTable dt, string ColName, string ColValue, string returnCol)
        {
            foreach (DataRow row in dt.Rows)
            {
                if (row[ColName].ToString().ToLower().Trim() == ColValue.ToLower().Trim())
                {
                    return row[returnCol].ToString();
                }
            }
            return "";
        }

C# search DataTable performance

I would like to know if there are ways to make this run faster. Not a big concern right now, but I would like to think long term, it might be important.

This is C#, and I can not change the input parameters data types, but basically I have to make something like the SQL: SELECT returnCol FROM dt WHERE ColName = ColValue

As the datatable itself: it has more than 100 columns, but it should not too many rows, usually ~10 rows but it can spike up to 100 rows sometimes. This is part of a data parse that is happening once a minute, that is why I am trying to see if there are ways for enhancement.

private string FindInT(DataTable dt, string ColName, string ColValue, string returnCol)
        {
            foreach (DataRow row in dt.Rows)
            {
                if (row[ColName].ToString().ToLower().Trim() == ColValue.ToLower().Trim())
                {
                    return row[returnCol].ToString();
                }
            }
            return "";
        }

ERROR TypeError: “$(…).DataTable is not a function”

I’m using datatables in an Angular 6 project. Following is the referce I used to create datatables. (I’m using the zero configuration approach)
I have followed the steps correctly and still get the above error. However I have created a fresh Angular project using Angular CLI and it works perfectly.
http://l-lin.github.io/angular-datatables/#/getting-started

I’m using a template and need to add datatables for one of the pages. Following are the errors encountered.

enter image description here

Error en Jquery Datatable al hacer scroll vertical

Tengo una tabla que esconde y enseña columnas dependiendo de un parámetro que le paso, todo va bien hasta que implemento el scroll vertical y me el siguiente error: Cannot read property ‘style’ of undefined.EN otras funciones que no escondo la columna, no recibo errores He intentado hacer un ejemplo demostrable pero no he sabido, estoy intentando hacerlo.

function busProyectosNtactil() {

    if ($("#chkOf").prop('checked')) {
        interruptor = '1';
    } else {
        interruptor = '0';
    }

    if ($("#prsp").prop('checked')) {
        prsp = '1';
    } else {
        prsp = '0';
    }


    var parametros = {
        "interruptor": interruptor,
        "prsp": prsp
    };


    tblProyectosNtactil = $('#tbl_ProyectosTactil').DataTable({
        scrollY: '35vh',
        "scrollCollapse": true,
        "scrollX": false,
        "bLengthChange": false,
        "bPaginate": true,
        "bInfo": false,
        "searching": true,
        "autoWidth": false,
        "responsive": true,

         "destroy": "true",
            "ajax": {
                "data": parametros,
                "url": "php/tos.php",
                "type": "POST",
                "dataSrc": "",
            },


            "columns": [ {
                    "data": "id"
                }, {
                    "data": "prio" ,"responsivePriority": "9"
                }, {
                    "data": "eje"
                },{
                    "data": "cta_id"
                },{
                    "data": 'emp',
                    render: function (data, type, row) {
                        emp = devuelveEmpresa(data)
                            return  emp;
                    }
                },{
                    "data": "nombre_seguimiento" ,"responsivePriority": "8"
                }, {
                    "data": "name" ,"responsivePriority": "3"
                }, {
                    "data": "dsc"
                }, {
                    "data": "nombre_director"
                }, {
                    "data": "nombre_responsable"
                }, {
                    "data": "nombre_grupo"
                }, {
                    "data": "prsp_acu_tot" ,"responsivePriority": "4"
                },{
                    "data": "prsp_sol" 
                },{
                    "data": "fch_fin_prevista" ,"responsivePriority": "5"
                }, ],
        });

        //Esto es lo que me provoca el error.
        if(prsp==1){
            tblProyectosNtactil.columns( [0,1,5,8,10,11,13] ).visible( false );
            tblProyectosNtactil.columns( [2,3,4] ).visible( true );
        }
        else if(prsp==0)
        {
            tblProyectosNtactil.columns( [1,5,8,10,11,13] ).visible( true );
            tblProyectosNtactil.columns( [0,2,3,4] ).visible( false );
        }
    });
}