problem searching in render column

problem searching in render column

monierjimenezmonierjimenez Posts: 1Questions: 0Answers: 0
edited January 2021 in Free community support

searchable, I'm using datatables with ajax, everything works fine for me, but now I search a column that looks like this:

{
            render: function( data, type, row, meta )
            {
              if( row['cliente_id'] == 0 ) 
                return 'Almacen Empresa';
              else if( row['vendido'] == 0 )
                return 'Almacen Cliente: ' + row['cliente'].nombre_completo ;
            }, searchable: true, orderable: true
}

not looking for me for that column. What could it be

Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

Replies

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923

    First you always need to return something with columns.render, something like this:

                  if( row['cliente_id'] == 0 )
                    return 'Almacen Empresa';
                  else if( row['vendido'] == 0 )
                    return 'Almacen Cliente: ' + row['cliente'].nombre_completo ;
                  return data;  // Default value if both if statements are false
    

    If you still need help we will need to see a running test case showing the problem. Without seeing your data and how the render function is working for your case it will be impossible to help. Please post a link to your page or a test case replicating the issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.