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.

Data is erased when updateRow and Mutator implemented.

See original GitHub issue

I’ve implemented Mutator to limit the Length of entered data and also an update Row when the Row selected. but row data is erased when row is selected.

myDiv.tabulator("updateRow", data.ID, {selected:'1'});

mutator:function(value, type, data){
    value = value.substring(0, 15);
   return value;
},

Am I doing something wrong? And How is the best way to implement a Mask?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
olifolkerdcommented, Nov 17, 2016

Great News!

In answer to you next question, you can mask any input with the html5 _pattern_ attribute.

In this case you would need to create your own variant of the input editor with the appropriate pattern:

//create editor
datePatternInputEditor = function(cell, value, data){
    //create and style input
    var input = $("<input type='text' pattern='\d{4}-\d{1,2}-\d{1,2}'/>");
    input.css({
        "padding":"4px",
        "width":"100%",
        "box-sizing":"border-box",
    })
    .val(value);
    if(cell.hasClass("tabulator-cell")){
        setTimeout(function(){
            input.focus();
        },100);
    }

    //submit new value on blur
    input.on("change blur", function(e){
        cell.trigger("editval", input.val());
    });

    //submit new value on enter
    input.on("keydown", function(e){
        if(e.keyCode == 13){
            cell.trigger("editval", input.val());
        }
    });

    return input;
},

//assign editor to column
$("#example-table-demo").tabulator({
    columns:[
        {title:"date", field:"date", editor:datePatternInputEditor },
    ]
});

0reactions
codevitecommented, Nov 17, 2016

It works Perfect. Thank you a lot!

Its possible to show a Mask in Editable Div? Ex: YYYY-MM-DD

Read more comments on GitHub >

github_iconTop Results From Across the Web

15.00 - System-Generated Observer and Mutator Methods
System‑Generated Observer and Mutator Methods When you create a structured UDT, the system automatically generates an observer method and a ...
Read more >
Insert, update, and delete data using mutations | Cloud Spanner
A mutation represents a sequence of inserts, updates, and deletes that Spanner applies atomically to different rows and tables in a Spanner database....
Read more >
tabulator - Mutator runs on update but cell data unchanged
The problem: When table.updateOrAddData([newData]) run, I can see the custom mutator get triggered and from the console.log() line, see that the ...
Read more >
Programming with the Java Class Library
Row objects inherit a multitude of accessor/mutator methods from the Buffer class. These methods allow you to set/get column data to/from a Row...
Read more >
mysql-connector-j/CHANGES at release/8.0 - GitHub
Fix for Bug#33637993, Loss of backslashes in data after modify api is used ... are implemented (not the mutators), and they return values...
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