Error: Syntax error, unrecognized expression: #row_10_03T35_S.C.

Error: Syntax error, unrecognized expression: #row_10_03T35_S.C.

commediacommedia Posts: 21Questions: 5Answers: 0
edited December 2016 in DataTables 1.10

Hi all!
I get this error

Syntax error, unrecognized expression: #row_10_03T35_S.C.

when I try to update or insert an item.

I need to set my field idArticolo when idSemeA is changed with select.

data is saved but I get the error before this

editor.on( 'postSubmit', function (e, json, data) {

If I comment out the following lines, data is saved, NO ERROR, but my idArticolo remains obviously the same

          editor.field( 'fromNav_Disponibilita.idArticolo' ).disable(); 
      editor.field('fromNav_Disponibilita.idSemeA').input().on( 'change', function ( e, d) {
            if ( d && d.editorSet ) return;
           var idArticoloForma = $( "select#DTE_Field_fromNav_Disponibilita-idAgente_persone option:selected" ).text();
            if (idArticoloForma != '') {
               idArticoloForma = idArticoloForma.split("-");
               idArticoloForma = idArticoloForma[1] + "_";
               idArticoloForma = idArticoloForma + editor.field( 'fromNav_Disponibilita.idProdottoA' ).val();
               idArticoloForma = idArticoloForma + "_";
               idArticoloForma = idArticoloForma + editor.field( 'fromNav_Disponibilita.idSemeA' ).val();
               editor.field( 'fromNav_Disponibilita.idArticolo' ).set(idArticoloForma);
            } else { // inline 
               var riga = $(this).closest('tr');
                   var col = $(riga).find("td").eq(2).html(); 
               idArticoloForma = col + "_";
               idArticoloForma = idArticoloForma + editor.field( 'fromNav_Disponibilita.idProdottoA' ).val();
               idArticoloForma = idArticoloForma + "_";
               idArticoloForma = idArticoloForma + editor.field( 'fromNav_Disponibilita.idSemeA' ).val();
               editor.field( 'fromNav_Disponibilita.idArticolo' ).set(idArticoloForma);
            }
        } );

I don't know how to debug this error to understand what happens.

Thanks
Pat

Answers

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Hi Pat,

    This is being caused by the .'s in your id value. Editor is trying to select the id in the DOM, but it isn't fully escaped.

    That should actually work okay in Editor. What version are you using? If not 1.6.0 could you update please?

    Allan

  • commediacommedia Posts: 21Questions: 5Answers: 0

    Hi Allan!
    Yes! I'm using 1.5.4. Ok I update it asap.
    Thanks
    Pat

  • commediacommedia Posts: 21Questions: 5Answers: 0

    Hi Allan,
    I have just updated to 1.6.0, but something is wrong.
    Also without the above lines, data is not saved and it give me back this error:

    editor = new $.fn.dataTable.Editor( {
          ....       
              error: {
                        system: "Si è verificato un errore"
                    },
            .....
    

    Can you help me?
    Thanks
    Pat

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Hi Pat,

    That error suggests that the server is not returning valid JSON. Could you show me what it is actually returning please? Details on how to do that are available here.

    Allan

  • commediacommedia Posts: 21Questions: 5Answers: 0

    {"data":[{"DT_RowId":"row_10_01D04_Tec","fromNav_Disponibilita":{"idArticolo":"10_01D04_Tec","idAgenteA":"10","idAgente_persone":"22","agente_nome":"FABRI","agente_cognome":"ARM","capo_id":"40","capo_nome":"ANT","capo_cognome":"LE","idProdottoA":"01D04","idSemeA":"S.C.","idVariante":"","dispo":"4547.00"},"fromNav_AnagraficheArticoli":{"prodId":"01D04","prodDesc":"FRUMENTO "},"righe_disponibilita":[]}]}

  • commediacommedia Posts: 21Questions: 5Answers: 0
    {"data":[{"DT_RowId":"row_10_01D04_Tec","fromNav_Disponibilita":{"idArticolo":"10_01D04_Tec","idAgenteA":"10","idAgente_persone":"22","agente_nome":"FABRI","agente_cognome":"ARM","capo_id":"40","capo_nome":"ANT","capo_cognome":"LE","idProdottoA":"01D04","idSemeA":"S.C.","idVariante":"","dispo":"4547.00"},"fromNav_AnagraficheArticoli":{"prodId":"01D04","prodDesc":"FRUMENTO "},"righe_disponibilita":[]}]}
    
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    That is valid JSON, but the error still suggests that there is something else going on making it invalid (since that is basically the only reason that error will be shown).

    Are you able to give me a link to the page so I can check it out please?

    Thanks,
    Allan

  • commediacommedia Posts: 21Questions: 5Answers: 0

    Hi Allan,
    I send you a private mail with an URL to my page.
    Thank you very much!

    Pat

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Thank you! It looks like Editor 1.6 has a compatibility error with jQuery older than 1.11. I've sent a PM with an updated Editor file. If you could let me know how you get on with it, that would be great.

    I expect to do an Editor 1.6.1 release in the next couple of days which will include this change.

    Allan

  • commediacommedia Posts: 21Questions: 5Answers: 0

    Hi Allan! All is ok now!
    My record is saved with NO ERRORS and idArticolo changes depending on select.
    Thank you very much!! Great!

    Pat

This discussion has been closed.