Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

199
Vistas
How to use 2 formatters in jquery bootgrid?

I am trying to use 2 data formatters and it's giving me a error SyntaxError: Unexpected string. If I am using only 1 formatter then it's working fine otherwise it's giving a error.How can I use both the formatters any idea?

var grid = $("#product_grid").bootgrid({
        ajax: true,
        rowSelect: true,
        post: function ()
        {
            /* To accumulate custom parameter with the request object */
            return {
                id: "b0df282a-0d67-40e5-8558-c9e93b7befed"
            };
        },
        
        url: "response.php",
        formatters: {
                "commands": function(column, row)
                {
                    return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.id + "\"><span class=\"glyphicon glyphicon-edit\"></span></button> " + 
                        "<button type=\"button\" class=\"btn btn-xs btn-default command-delete\" data-row-id=\"" + row.id + "\"><span class=\"glyphicon glyphicon-trash\"></span></button>";
                }

                "file": function(column,row)
                {
                    return "<img src=\"img/" + row.file + "\" width=50px/>";
                }
            }
        
<table id="product_grid" class="table table-condensed table-hover table-striped" width="60%" cellspacing="0" data-toggle="bootgrid">
            <thead>
                <tr>
                    <th data-column-id="id" data-type="numeric" data-identifier="true">Product ID</th>
                    <th data-column-id="p_name">Product</th>
                    <th data-column-id="mrp">MRP</th>
                    <th data-column-id="selling_price">Selling Price</th>
                    <th data-column-id="category">Category</th>
                    <th data-column-id="description">Description</th>
                    <th data-column-id="file" data-formatter="file" data-sortable="false">Image</th> 

                    <th data-column-id="commands" data-formatter="commands" data-sortable="false">Commands</th>
                </tr>
            </thead>
        </table>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Nikhil, You appear to be missing a comma between "commands" & "file" formatter functions

formatters: {
    "formatter1": function(column, row)
    {
        return /* your code here */;
    },
    "formatter2": function(column, row)
    {
        return /* your code here */;
    },
    "formatter3": function(column, row)
    {
        return /* your code here */;
    }
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda