@boikom

@boikom

Forum Replies Created

Viewing 15 posts - 721 through 735 (of 918 total)
  • Author
    Posts
  • in reply to: Not able to apply xpand-mode="multiple" property to accordion #100497
    admin
    Keymaster

    So silly mistake…thanks i got it…!

    in reply to: Not able to apply xpand-mode="multiple" property to accordion #100496
    admin
    Keymaster

    Hi Nainar9294,
    seems like you have misspelled the property name, the correct name of the property is “expand-mode”.
    Best Regards,
    Denis
    Smart HTML Elements Team
    https://www.htmlelements.com

    in reply to: localization #100481
    admin
    Keymaster

    Hello FabioNicc,
    we prepared a localization demo for you. Here is how you can set the messages property:

    grid.messages = {
            'en': {
                'columnMenuItemSortAsc': 'Sort {{mode}}',
                'columnMenuItemSortDesc': 'Sort {{mode}}', //Sort A → Z
                'columnMenuItemRemoveSort': 'Remove Sort',
                'currencySymbol': '£',
            },
            'de': {
                'columnMenuItemSortAsc': 'Sortieren {{mode}}',
                'columnMenuItemSortDesc': 'Sortieren {{mode}}',
                'columnMenuItemRemoveSort': 'Sortierung entfernen',
                'currencySymbol': '€',
            },
        };
    

    and by switching the “locale” property, you can change the language code:

    grid.locale = 'de';
    

    or

    grid.locale = 'en';
    

    We also implemented two format functions. The first one translates the month of the date, and the second one switch the currency symbol according to the selected language.
    Here is the index.htm file for the demo:

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Grid Localization Example</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
    	<link rel="stylesheet" type="text/css" href="../../../source/styles/smart.default.css" />
    	<link rel="stylesheet" type="text/css" href="../../../styles/demos.css" />
        <link rel="stylesheet" type="text/css" href="styles.css" />
        <script src="../../../scripts/data.js"></script>
    </head>
    <body class="viewport">
        <smart-grid id="grid"></smart-grid>
        <div class="options">
            <div class="caption">
                Language:
            </div>
            <div class="option"><br />
                <smart-radio-button class="language" id="en" enable-container-click>English</smart-radio-button><br/>
                <smart-radio-button class="language" id="de" enable-container-click checked>Deutsch</smart-radio-button>
            </div>
        </div>
        <!-- scripts -->
        <script type="module" src="../../../source/modules/smart.grid.js"></script>
        <script type="module" src="../../../source/modules/smart.radiobutton.js"></script>
        <script type="module" src="index.js"></script>
    </body>
    </html>
    

    Here is the index.js file:

    function setLocalizationCurrency(grid, currency) {
        return grid.localize('currencySymbol') + currency.toFixed(2);
    }
    function setLocalizationDate(grid, date) {
        let dateLocale = 'de-DE';
        if (grid.locale === 'en') {
            dateLocale = 'en-GB';
        }
        return date.toLocaleString(dateLocale, { timeZone: 'UTC', weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
    }
    let localizationColumnLabelsDe = [
        {
            label: 'Vorname' //First Name
        },
        {
            label: 'Familienname' //Last Name
        },
        {
            label: 'Datum' //Date
        },
        {
            label: 'Gesamt' //Total
        },
    ];
    let localizationColumnLabelsEn = [
        {
            label: 'First Name'
        },
        {
            label: 'Last Name'
        },
        {
            label: 'Date'
        },
        {
            label: 'Total'
        },
    ];
    let defaultLocalizationColumnLabels = localizationColumnLabelsDe;
    window.onload = function () {
        const radioButtons = document.querySelectorAll('smart-radio-button.language');
        const grid = document.getElementById('grid');
        grid.locale = 'de'; //Settings default locale
        grid.messages = {
            'en': {
                'columnMenuItemSortAsc': 'Sort {{mode}}',
                'columnMenuItemSortDesc': 'Sort {{mode}}', //Sort A → Z
                'columnMenuItemRemoveSort': 'Remove Sort',
                'currencySymbol': '£',
            },
            'de': {
                'columnMenuItemSortAsc': 'Sortieren {{mode}}',
                'columnMenuItemSortDesc': 'Sortieren {{mode}}',
                'columnMenuItemRemoveSort': 'Sortierung entfernen',
                'currencySymbol': '€',
            },
        };
        for (let i = 0; i < radioButtons.length; i++) {
            const radioButton = radioButtons[i];
            radioButton.addEventListener('change', function (event) {
                let localizationColumnLabels = defaultLocalizationColumnLabels;
                if (event.detail.value) {
                    if (this.id === 'en') {
                        localizationColumnLabels = localizationColumnLabelsEn;
                    }
                    //Update column labels
                    for (let i = 0; i < localizationColumnLabels.length; i++) {
                        grid.columns[i].label = localizationColumnLabels[i].label;
                    }
                    grid.locale = this.id;
                }
            });
        }
    }
    Smart('#grid', class {
    	get properties() {
            return {
    			appearance: {
    				alternationCount: 2,
    				showRowHeader: true,
    				showRowHeaderSelectIcon: true,
    				showRowHeaderFocusIcon: true
    			},
    			paging: {
    				enabled: true
    			},
    			pager: {
    				visible: true
    			},
    			sorting: {
    				enabled: true
    			},
                editing: {
                    enabled: false,
                },
    			selection: {
    				enabled: true,
    				allowCellSelection: true,
    				allowRowHeaderSelection: true,
    				allowColumnHeaderSelection: true,
    				mode: 'extended'
    			},
    			behavior: { columnResizeMode: 'growAndShrink' },
                dataSource: new Smart.DataAdapter(
                    {
                        dataSource: generateData(32),
    				dataFields:
    				[
    					'id: number',
    					'firstName: string',
    					'lastName: string',
    					'date: string',
    					'total: number'
    				]
    			}),
    			columns: [
    			{ label: defaultLocalizationColumnLabels[0].label, dataField: 'firstName' },
                { label: defaultLocalizationColumnLabels[1].label, dataField: 'lastName' },
                {
                    label: defaultLocalizationColumnLabels[2].label, dataField: 'date', formatFunction(settings) {
                        settings.value = new Date(settings.value);
                        settings.value = setLocalizationDate(grid, settings.value);
                    }
                },
                {
                    label: defaultLocalizationColumnLabels[3].label, dataField: 'total', cellsFormat: 'c2',
                    formatFunction(settings) {
                        settings.value = setLocalizationCurrency(grid, settings.value);
                    }
                }
    			],
    		}
    	}
    });
    

    Best regards,
    Denis
    Smart HTML Elements Team
    https://www.htmlelements.com

    in reply to: Dynamically add new data bound elements and variables #100467
    admin
    Keymaster

    Hi Starlight Sparkle,
    Injecting spans into body is OK, if it is in the APP’s context. Otherwise, they won’t be rendered, as they are outside the App. Please, refer to the examples in the Framework demo section(ex: https://www.htmlelements.com/demos/framework/data-binding/) and the code we posted here in order to get the desired results.
    Best Regards,
    George
    Smart HTML Elements Team
    https://www.htmlelements.com

    in reply to: Dynamically add new data bound elements and variables #100466
    admin
    Keymaster

    I have tried doing things in the following order

    1. Construct Smart.App object with blank parameter (aka {})
    2. Inject new span with double bracket into body after page load
    3. Set data value

    It does not appear to replace the value contained in double brackets — it just continues to display the double brackets.
    Adding the data value before the span has been injected, but after page load, does not appear to have any difference.
    In addition, swapping the order of steps 1 and 2 appears to cause the entire page to blank out, including elements unrelated to the operation.

    in reply to: Dynamically add new data bound elements and variables #100465
    admin
    Keymaster

    Hi,
    smart-model is compatible with sub-property binding and we have demo about that: https://www.htmlelements.com/demos/framework/sub-property-binding/.
    It is also possible to dynamically add additional objects to app.data.
    For example:

    window.onload = function() {
    const app = new Smart.App(
    {
    data: {
    details: {
    subject: "About Transaction",
    message: "Hey, Peter. Take a look at the items, I sent you earlier."
    }
    }
    }
    )
    app.data.test = 'test';
    }

    HTML

    	<div class="demo-description">
    TextBox and MultilineTextBox are bound to sub properties.
    </div>
    <br/>
    <smart-text-box smart-model="details.subject" id="textBox1"></smart-text-box> <br/><br/>
    <smart-multiline-text-box smart-model="details.message" id="textBox2"></smart-multiline-text-box>
    <br/>
    <span>{{details.subject}}</span>
    <br/>
    <span>{{details.message}}</span>
    <span>{{test}}</span>

    Demo: https://codepen.io/boyko-markov/pen/NWWvBRx?&editable=true
    If it is array and you add it like that:

     app.data.array = ['hi', 'bye'];

    in HTML you can refer it like that:

    	<span>{{array.0}}</span>

    Best Regards,
    George
    Smart HTML Elements Team
    https://www.htmlelements.com

    in reply to: Change tab title #100463
    admin
    Keymaster

    Hi Starlight Sparkle,
    the newly added item via the “addNewTab” button always has a label of “New Tab” and it’s not possible to change that via API. However since the new item becomes the selected item by default you can accomplish the same result by binding to the change event and calling update method on it. Here’s how to do it:

    
    document.querySelector('smart-tabs').addEventListener('change', function (event) {
            const newTabIndex = event.detail.index;
            //Get all tab items inside the element
            const allTabItems = this.querySelectorAll('smart-tab-item');
            //Update the label
            if (allTabItems[newTabIndex].label === 'New Tab') {
                this.update(newTabIndex, 'New Custom Label');
            }
        });
    

    Best Regards,
    Christopher
    Smart HTML Elements Team
    https://www.htmlelements.com

    in reply to: Change tab title #100458
    admin
    Keymaster

    Damn, can’t believe I missed that in the documentation. Sorry and thanks!
    But on a related note, is it possible to set the default label that will be used by new tabs created through the built-in “new tab” button?

    in reply to: Change tab title #100448
    admin
    Keymaster

    Hello Starlight Sparkle,
    Thank you for your interest. The proper way to update a tab item’s label and/or content is by calling the method update. Here is an example of setting only the title:
    document.getElementById('tabs').update(0, 'Updated title');
    If you wish to change the content, too, pass a third argument, e.g.:
    document.getElementById('tabs').update(0, 'Updated title', 'Updated content');
    Here is also a demo that showcases this method among others: https://www.htmlelements.com/demos/tabs/insert-remove-update/.
    Best regards,
    Dimitar
    Smart HTML Elements Team
    https://www.htmlelements.com

    in reply to: grid appearence showRowNumber not working in 4.5>= #100446
    admin
    Keymaster

    Hi cetinsert,
    Since you are using this product for months now. Could you share your license key, please?
    Best Regards,
    George
    Smart HTMLElements Team
    https://www.htmlelements.com

    in reply to: grid appearence showRowNumber not working in 4.5>= #100445
    admin
    Keymaster

    Indeed, changing showRowNumber to showRowHeaderNumber works.
    This must have been a simple oversight in your packaging or htmlelements.com demos might have been revised since 4.6 was published.
    Thank you for your prompt response!

    in reply to: grid appearence showRowNumber not working in 4.5>= #100444
    admin
    Keymaster

    https://www.htmlelements.com/demos/grid/row-headers/
    has showRowHeaderNumber.
    Please consult your own resources before responding to ensure an informed answer.

    in reply to: grid appearence showRowNumber not working in 4.5>= #100443
    admin
    Keymaster

    What is the current recommended solution for displaying row numbers?
    /demos/grid/row-headers/ are still distributed with 4.5 and 4.6.

    in reply to: grid appearence showRowNumber not working in 4.5>= #100442
    admin
    Keymaster

    Hello,
    Such Grid property is not available in the current version. This is by design.
    Regards,
    George
    HTML Elements Team
    https://www.htmlelements.com

    in reply to: Custom angular components not rendered in panel content #100436
    admin
    Keymaster

    Hi mgndzz,
    Have a look at this topic Angular Dynamic Component Loading. It demonstrates how to load Dynamic Angular Components with our smart framework. If that doesn’t help you out you can export your angular component as a custom element and use the custom element.
    Best Regards,
    Christopher
    Smart HTML Elements Team
    https://www.htmlelements.com

Viewing 15 posts - 721 through 735 (of 918 total)