how to cancel the add new row

how to cancel the add new row

elgarchelgarch Posts: 13Questions: 0Answers: 0
edited March 2012 in General
Hello Everybody,

I have a problem and i don't know how to solve it, i hope i'll find a solution here :)

I click for example on add new row, i didn't clicked on save, but instead i clicked on edit another existing row, the problem is the new row is empty and added to the table and it's logical because in edit function i call the restore, what i want to know, is there any method to know that new row so i can do a test and delete it.

I hope that i was clear, if not i'm here for more details thanks for all ;)

El garch Hicham

Replies

  • elgarchelgarch Posts: 13Questions: 0Answers: 0
    any suggestion ??
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    What are you using to do the editing? I guess the answer will lie in whatever editing script you are using and adding the logic required. Sorry to not be more helpful, but I don't know what code is being used :-)

    Allan
  • elgarchelgarch Posts: 13Questions: 0Answers: 0
    Thanks Allan for your response, this my code :


    /**************************************************************/
    /* tableau page : project_admin_list_profils_ratecard.html */
    /**************************************************************/


    var localizationDatatable = {
    "sPaginationType": "bootstrap",
    "oLanguage": {
    "sProcessing": "Traitement en cours...",
    "sLengthMenu": "Afficher _MENU_ éléments",
    "sZeroRecords": "Aucun élément à afficher",
    "sInfo": "Affichage de l'élement _START_ à _END_ sur _TOTAL_ éléments",
    "sInfoEmpty": "Affichage de l'élement 0 à 0 sur 0 éléments",
    "sInfoFiltered": "(filtré de _MAX_ éléments au total)",
    "sInfoPostFix": "",
    "sSearch": "Rechercher :",
    "sLoadingRecords": "Téléchargement...",
    "sUrl": "",
    "oPaginate": {
    "sFirst": "Premier",
    "sPrevious": "Précédent",
    "sNext": "Suivant",
    "sLast": "Dernier"
    }
    },
    "sDom": '<""pfl>rt<""ip><"clear">'


    };
    var oTable = $('#list-profils table').dataTable(localizationDatatable);
    var nEditing = null;

    $('#list-profils table a.edit').live('click', function (e) {
    e.preventDefault();

    /* Get the row as a parent of the link that was clicked on */
    var nRow = $(this).parents('tr')[0];

    if ( nEditing !== null && nEditing != nRow ) {
    /* A different row is being edited - the edit should be cancelled and this row edited */
    restoreRow( oTable, nEditing );
    editRow( oTable, nRow );
    nEditing = nRow;
    }
    else if ( nEditing == nRow && $(this).hasClass('saveRow')) {
    /* This row is being edited and should be saved */
    saveRow( oTable, nEditing );
    nEditing = null;
    }
    else {
    /* No row currently being edited */
    editRow( oTable, nRow );
    nEditing = nRow;
    }
    } );

    function editRow ( oTable, nRow )
    {
    var aData = oTable.fnGetData(nRow);
    var jqTds = $('>td', nRow);


    // column Nom du profil
    var listProfilName = ['Webmaster', 'Quality Manager', 'Html Developper', 'Flasheur', 'Artistic Director', 'Creative Graphist', 'Senior Writter', 'Writter', 'Innovative Planner', 'Strategic Planning', 'Cretive Director', 'Senior VP Creative', 'Senior Project Manager', 'Technical Project Manager', 'Project Manager', 'Account Manager', 'Partner', 'Executive Sponsor'];
    var profilsNameSelect ='';

    $.each(listProfilName, function(i, value){
    if(value != aData[0]){
    profilsNameSelect +=''+value+'';
    }else{
    profilsNameSelect +=''+value+'';
    }
    });
    profilsNameSelect +="
This discussion has been closed.