datagrid icon indicating copy to clipboard operation
datagrid copied to clipboard

Cell edit (small edit) and datepicker

Open BigOHenry opened this issue 7 years ago • 4 comments

Please add support of custom (etc. bootstrap) datetimepicker (date and datetime) in column edit.

BigOHenry avatar Nov 09 '18 12:11 BigOHenry

There is a workaround. You should wait on snippet sent. And it's necessary to handle a row used for new records.

//
// It's necessary to set data-my-input attribute in your PHP addInlineEdit() and addInlineAdd() functions
//
// call this code during page initialization
// all inputs having data-my-input are processed
//
$('a[data-datagrid-toggle-inline-add="true"]').click(function () {
    // inputs used for new records
    $('tr.datagrid-row-inline-add td.datagrid-inline-edit input[data-my-input]').each(function () {
        // you can set class or data attributes here
        $(this).attr('class', 'any class');
    });
});


$.nette.ext('script.datagrid.handling', {
    success: function(payload) {
        if (payload._datagrid_inline_editing) {
            $('td.datagrid-inline-edit input[data-my-input]').each(function () {
                // you can set class or data attributes here
                $(this).attr('class', 'any class');
            });
        }
    }});

janmottl avatar Nov 22 '18 06:11 janmottl

@janmottl It is possible to do it with small edit? Your example is for big editing.

mabezdek avatar Sep 10 '19 13:09 mabezdek

@mabezdek I don't use small editing. So I dion't have experience how to implement it. DataGrid creates textarea inside td element when particular editing starts. So it will be necessary to catch element creation. Edited td has class 'editing' so it can be identified by that.

I sketch just an idea how it could be done. ` $("body").on("DOMNodeInserted", "textarea", function () {

if ($(this).closest("td").hasClass("editing")) {

	$(this).addClass("class", "any class"); // set class and attributes you need

}

}); `

janmottl avatar Sep 12 '19 04:09 janmottl

Let's keep this issue in scope of data picker. Date time picker is in another issue. Thanks. 👍

paveljanda avatar Sep 19 '19 15:09 paveljanda