EasyUI Forum
May 15, 2024, 10:58:46 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: 1 ... 6 7 [8] 9 10
 71 
 on: November 21, 2023, 11:00:45 PM 
Started by Aod47 - Last post by Aod47
I try the code below

Code:
<input class="easyui-textbox" id="textbox1">

<div id="mm" class="easyui-menu" style="width:120px;">
    <div data-options="iconCls:'icon-copy'">Copy</div>
    <div data-options="iconCls:'icon-cut'">Cut</div>
    <div class="menu-sep"></div>
    <div data-options="iconCls:'icon-paste'">Paste</div>           
</div>

$(document).ready(function (data) {
    $(document).bind('contextmenu', function (e) {
        var t = $(e.target).closest('.validatebox-text');
        if (!t.length) {
            e.preventDefault();
            $('#mm').menu('show', {
                left: e.pageX,
                top: e.pageY
            });
        } 
    });
});


When right click any position on display will show contextmenu 'mm'
but I want to show contextmenu when right click at textbox1 only.

Could you please advice? Many Thank.

 72 
 on: November 21, 2023, 12:02:58 PM 
Started by WizPS - Last post by don
Yes, just make sure you install the correct version (npm install v3-easyui --save).

 73 
 on: November 14, 2023, 04:26:12 AM 
Started by rezzonico - Last post by rezzonico
Thanks !

Regards
Miche

 74 
 on: November 14, 2023, 01:32:01 AM 
Started by rezzonico - Last post by jarry
Please extend a new operator to filter multiple values.
Code:
$.extend($.fn.datagrid.defaults.operators, {
    mequal: {
        text: 'Equal',
        isMatch: function (source, value) {
            const vv = value.split(',');
            const index = vv.indexOf(source);
            return index != -1;
        }
    }
})

And then apply it to your code.
Code:
onChange: function (value) {
    if (value == '') {
        dg_HW.datagrid('removeFilterRule', 'Year');
    } else {
        dg_HW.datagrid('addFilterRule', {
            field: 'Year',
            op: 'mequal',
            value: value.join(',')
        });
    }
    dg_HW.datagrid('doFilter');
}

 75 
 on: November 09, 2023, 08:58:26 AM 
Started by rezzonico - Last post by rezzonico
Hi,

I have a datagrid with "enableFilter". In the filter, I have a combobox with the property "multiple: true".
If you select a line in the combobox, an error is received in the console.
How can I avoid this ?

See the code here:
http://217.193.156.220/BBB/


Thanks
Miche

 76 
 on: October 23, 2023, 07:00:32 AM 
Started by shivavalkyre - Last post by shivavalkyre
Hi,

It is possible to hide item/nodes in sidemenu?

Or if it not possible how to clear selection item in sidemenu

Best regard

 77 
 on: October 16, 2023, 09:13:30 AM 
Started by Wojak - Last post by Wojak
Thanks for advice  Wink

Works like a glove

 78 
 on: October 14, 2023, 06:14:00 PM 
Started by Wojak - Last post by jarry
This code shows how to swap two rows in a datagrid.
Code:
var index1 = 2;
var index2 = 3;
var dg = $('#dg');
var rows = dg.datagrid('getRows');
var temp = rows[index1];
rows[index1] = rows[index2];
rows[index2] = temp;
dg.datagrid('refreshRow',index1);
dg.datagrid('refreshRow',index2);

 79 
 on: October 05, 2023, 03:28:17 PM 
Started by Wojak - Last post by Wojak
Hi,
I would like to add a button that allows the rows to be swapped up and down. I found a post from 2014, but it doesn't work Sad

https://www.jeasyui.com/forum/index.php?topic=3634.0

Snippet of the code
Code:
function dgSwapColumns(from, to) {
      $('#dg).datagrid('moveRow', { from: from, to: to });
}

It gives me this error
Code:
Uncaught TypeError: $.fn.datagrid.methods[_8ee] is not a function
    at $.fn.datagrid (<anonymous>:12356:35)
    at dgSwapColumns ((index):89:30)
    at HTMLAnchorElement.onclick ((index):1:1)

 80 
 on: September 27, 2023, 09:22:06 AM 
Started by lloyd - Last post by lloyd
Hi,

I have created a combobox search that lookup postcodes (zipcodes). But I do not want the the combobox text changed when the user selects an address.

How do I prevent combobox onSelect from changing (setting) the combobox textbox?

Code:
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Address Finder</title>
    <link href="js/easyUI/themes/metro/easyui.css" rel="stylesheet" type="text/css">
    <link href="js/easyUI/themes/icon.css" rel="stylesheet" type="text/css">
    <script src="js/easyUI/jquery.min.js" type="text/javascript"></script>
    <script src="js/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
</head>
<body>
    <div class="content">
        <p>(Free test code: WR5 3DA)</p>
        <input id="searchBox" class="easyui-combobox" style="width: 14%;" data-options="
            mode: 'remote',
            valueField: 'id',
            textField: 'name',
            required: true,
            label: 'Enter Address:',
            labelPosition: 'top',
            hasDownArrow: false,
            iconCls: 'icon-search',
            onSelect: findAddress,
            loader: loadAddresses
        ">
    </div>

    <script>
        var key = 'myKey';
        var isMiddleware = false;
        var origin = '';
        var countries = 'GBR';
        var limit = '10';
        var language = 'en-gb';
        var field1Format = '';

        function loadAddresses(param, success, error) {
            if (param === undefined) {
                return;
            }
            else {
                var q = param.q || '';
            }

            q = $.trim(q);

            if (q === '') {
                return;
            }

            $('.textbox-icon').last().removeClass('icon-search');
            $('.textbox-icon').last().addClass('icon-loading');
        
            $.ajax({
                url: 'https://services.postcodeanywhere.co.uk/Capture/Interactive/Find/v1.10/json3.ws',
                method: 'POST',
                data: {
                    Key: key,
                    Text: q,
                    IsMiddleware: isMiddleware,
                    Origin: origin,
                    Countries: countries,
                    Limit: limit,
                    Language: language
                },
                success: function(data) {
                    var items = $.map(data.Items, function(item) {
                        return {
                            id: item.Id,
                            name: item.Text + ' ' + item.Description,
                            description: item.Description,
                            text: item.Text,
                            type: item.Type
                        };
                    });

                    $('.textbox-icon').last().removeClass('icon-loading');
                    $('.textbox-icon').last().addClass('icon-search');

                    success(items);
                },
                error: function () {
                    error.apply(this, arguments);
                }
            });
        }

        function findAddress(record) {
            if (!record) {
                return;
            }

            $('.textbox-icon').last().removeClass('icon-search');
            $('.textbox-icon').last().addClass('icon-loading');
        
            var url = '';
            var params = '';
            var address = $(this).combobox('getText');

            params += 'Key=' + encodeURIComponent(key);

            if (record.type === 'Address') {
                url = 'https://services.postcodeanywhere.co.uk/Capture/Interactive/Retrieve/v1.00/json3.ws';
                params += '&Id=' + encodeURIComponent(record.id);
                params += '&Field1Format=' + encodeURIComponent(field1Format);
            }
            else {
                url = 'https://services.postcodeanywhere.co.uk/Capture/Interactive/Find/v1.10/json3.ws';
                params += '&Text=' + encodeURIComponent(address);
                params += '&IsMiddleware=' + encodeURIComponent(isMiddleware);
                params += '&Container=' + encodeURIComponent(record.id !== undefined ? record.id : '');
                params += '&Origin=' + encodeURIComponent(origin);
                params += '&Countries=' + encodeURIComponent(countries);
                params += '&Limit=' + encodeURIComponent(limit);
                params += '&Language=' + encodeURIComponent(language);
            }

            $.ajax({
                type: 'POST',
                url: url,
                data: params,
                success: function(data) {
                        if (record.type === 'Address') {
                            $('#searchBox').combobox('setValue', data.Items[0].PostalCode);
                        }
                        else {
                            var items = $.map(data.Items, function(item) {
                                return {
                                    id: item.Id,
                                    name: item.Text + ' ' + item.Description,
                                    description: item.Description,
                                    text: item.Text,
                                    type: item.Type

                                };
                            });
                            
                            $('#searchBox').combobox('loadData', items);
                            // Replace the selected value with the user's input
                            $('#searchBox').combobox('setValue', address);

                            $('.textbox-icon').last().removeClass('icon-loading');
                            $('.textbox-icon').last().addClass('icon-search');

                            $('.combo-panel').panel('open');
                        }
                    },
                    error: function () {
                        error.apply(this, arguments);
                    }
            });
        }
    </script>
</body>
</html>


Pages: 1 ... 6 7 [8] 9 10
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!