question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

formatter -> get the field (column)

See original GitHub issue

Hello, I am using this fabulous pluggin with xeditable. I wish to let users edit images. I know that’s not work, but i have found a work around : -> I show the url of the image in the editable field, -> I show the image just below using the formatter

the pb is that I need the column variable in the formater function in order to set the data-name attribute.

Here is the formatter function

function show_image(value, row, index) {
    return [
        '<a  data-type="text" data-value="'+ value +'" data-pk="1" data-name="" href="javascript:void(0)" class="editable editable-click">'+ value +'</a><img src="'+ value +'" style="max-height:100px">'
    ].join('');
};

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
wenzhixincommented, May 11, 2016

You can use formatter to save the field name:

{
    title: 'Name',
    field: 'name',
    formatter: function () {
        return '<input type="checkbox" data-field="' + this.field + '>"';
    },
    events: {
        'change :checkbox': function (e, value, row, index) {
            var field = $(this).data('field');
            if ($(e.target).prop('checked')) {
                row[field] = "1";
            } else {
                row[field] = "0";
            }
            // Call updateRow, etc.
        }
    }
}
2reactions
wenzhixincommented, Feb 17, 2017

@arthipesa, try this:

var fields = $('#table').bootstrapTable('getVisibleColumns').map(function (column) {
  return column.field;
});
// fields[fields.indexOf(this.field) + 1];
// fields[fields.indexOf(this.field) - 1];
Read more comments on GitHub >

github_iconTop Results From Across the Web

Use column formatting to customize SharePoint | Microsoft Learn
You can use column formatting to customize how fields in SharePoint lists and libraries are displayed. To do this, you construct a JSON...
Read more >
Get other field value in JSON column formatting
I cannot find a way to include values from other columns in my display result. This should be a very common scenario, e.g....
Read more >
Apply column format to SharePoint column | PnP Samples
This sample script shows how to apply column format using: Existing column format; Format added in script; Getting format sample from GitHub sample...
Read more >
Working with Data: Value Getter & Value Formatter - AG Grid
Example - Getters and Formatters · Column 'Number' is a simple column with a field to get the data and without formatting. ·...
Read more >
Column Formatting Client-Side Web Part: Column Formatter
Modern listviews support the addition of custom formatting for most field types. This is an awesome feature designed to make custom formatting ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found