Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda