This is a migrated thread and some comments may be shown as answers.

Bug: setting table and cell width as a percentage within Kendo Editor

3 Answers 414 Views
Editor
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 25 Jul 2018, 12:55 AM

There is a bug setting the percentage width for a table within the Kendo editor. 

1. Go to https://demos.telerik.com/kendo-ui/editor/index
2. Under Editor / Basic usage select the Table Wizard Icon and click Table Wizard to bring up the Wizard Dialog
3. You will notice that within this dialog the unit options for width and height are only px and em
4. Within this dialog create a table two columns and four rows
5. Place your cursor in one of the table cells again and click the Table Wizard button again to edit the propertied of the new table
6. The unit options for width and height are still only px and em.  Go ahead and enter 100px into the width field and click Ok on the dialog
7. Once again with you cursor in one of the table cells, click the Table Wizard button again.  Now the units options for all widths and heights for tables and cells are px, em and importantly %
8. If I now create a new table via the Table Wizard the unit options available are px, em and % as expected

I logged a previous, different bug about the Table Wizard in github here: https://github.com/telerik/kendo-ui-core/issues/4390 but have had no response, so is this the correct place for bug reports, or github?

 

 

3 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 26 Jul 2018, 01:57 PM
Hello Jon,

Thank you for reporting the issues. 

The percentage option in the Table Wizard is not available initially. It is available after a table is created and the user needs to edit it. This behavior is by design. The reason is that having percentage initially for cell, might lead to undesired behavior. The wizard uses the same units for Cell and Table, so the percentage is hidden initially. If you create a table and click on the Cell tab, you will see that there is a percent value in the width input only in editing mode. 
If you need to have percentage initially when you are creating the table fro the Table Wizard you could use the following script:
var oldAddUnit = kendo.ui.editor.TableWizardDialog.fn._addUnit;
kendo.ui.editor.TableWizardDialog.fn._addUnit = function (units, value) {
    if ($.inArray("%", units) == -1) {
        units.push("%");
    }
 
    oldAddUnit.call(this, units, value)
}
Here is a Dojo example where the percentage option is available.

Regarding the second issue - you have logged the bug in the correct place. Thank you for your effort.
As a sign of gratitude for reporting a bug I have updated your Telerik points. 

Regards,
Neli
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
John A
Top achievements
Rank 1
answered on 13 Mar 2019, 07:27 PM

Hi,

 

Very similar to this question, how can I change the default values of cols and rows in table wizard for mvc core?

 

Thank you

0
Ivan Danchev
Telerik team
answered on 15 Mar 2019, 12:55 PM
Hi,

You can change the default Columns and Rows values in the Table Wizard dialog in the Execute event handler, as demonstrated below:
@(Html.Kendo().Editor()
    .Name("editor")
    .Events(events => events
        .Execute("onExecute")
    )
)
 
<script>
    function onExecute(e) {
        console.log("executing command", e.name, e.command);
        if (e.name == "tablewizardinsert") {
            setTimeout(function () {
                var colNumeric = $("#k-editor-table-columns").data("kendoNumericTextBox");
                var rowNumeric = $("#k-editor-table-rows").data("kendoNumericTextBox");
 
                colNumeric.value(6);
                rowNumeric.value(6);
            }, 0);
        }
    }
</script>


Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Editor
Asked by
n/a
Top achievements
Rank 1
Answers by
Neli
Telerik team
John A
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or