liferay / liferay-aui-upgrade-tool

Upgrade themes/plugins from Liferay Portal 6.1 to 6.2
13 stars 94 forks source link

LAUT does not convert aui-autocomplete scripts #45

Closed vikasvijendra closed 10 years ago

vikasvijendra commented 10 years ago

The following AUI script works for auto complete in 6.1 but LAUT is not able to convert it for 6.2. Would be nice to add some support as I'm having to re-implement the whole auto-complete functionality looking at LR 6.2 source code manually. The alloyui.com does not even have a working example for auto-complete on Alloy 2.0

<aui:script use="aui-autocomplete"> 

    var dataSource = new A.DataSource.IO(
        {
            source: '<%=ajaxResourceURL.toString()%>'
        }
    );
    var suburbs = [
      ['3000','Melbourne','VIC'],
      ['3141','South Yarra', 'VIC']     
    ];
    var streets = [
      ['Collins St','Melbourne','VIC'],
      ['Bourke St','Melbourne','VIC']
    ];
    var autoCompletePostCode = new A.AutoComplete(
    {
        dataSource: suburbs,
        delimChar: '',
        input:'#<portlet:namespace />postCode',
        contentBox: '#postCodeDiv',
        matchKey: 'postcode',
        schema: {
            resultFields: ['postcode','suburb','state']
        },
        uniqueName:'keyword',
        typeAhead: true        
    });
    autoCompletePostCode.on('itemSelect', function(event, item) {
        A.one('#<portlet:namespace />state').val(item.state);
        A.one('#<portlet:namespace />suburb').val(item.suburb);
        A.one('#<portlet:namespace />streetName').attr('readOnly', '');
        A.one('#<portlet:namespace />streetNumber').attr('readOnly', '');
    });
    var autoCompleteSuburb = new A.AutoComplete(
    {
        dataSource: suburbs,
        delimChar: '',
        input:'#<portlet:namespace />suburb',
        contentBox: '#suburbDiv',
        matchKey: 'suburb',
        schema: {
           resultFields: ['postcode','suburb','state']
        },
        uniqueName:'keyword',
        typeAhead: true        
    });
    autoCompleteSuburb.on('itemSelect', function(event, item) {
        A.one('#<portlet:namespace />state').val(item.state);
        A.one('#<portlet:namespace />postCode').val(item.postcode);
        A.one('#<portlet:namespace />streetName').attr('readOnly', '');
        A.one('#<portlet:namespace />streetNumber').attr('readOnly', '');
    });
    var autoCompleteStreetName = new A.AutoComplete(
    {
        dataSource: streets,
        delimChar: '',
        input:'#<portlet:namespace />streetName',
        contentBox: '#streetNameDiv',
        matchKey: 'streetName',
        schema: {
            resultFields: ['streetName','suburb','state']
        },
        uniqueName:'keyword',
       typeAhead: true        
    });
    autoCompletePostCode.render();
    autoCompleteSuburb.render();
    autoCompleteStreetName.render();
</aui:script>
ipeychev commented 10 years ago

Could you try to rename the module to "aui-autocomplete-deprecated" and see if this will resolve the issue?

<aui:script use="aui-autocomplete-deprecated">
ipeychev commented 10 years ago

About AutoComplete in 6.2, the preferred way is to use the AutoComplete from YUI: http://yuilibrary.com/yui/docs/autocomplete/

Those, which was in Alloy 1.7.x was deprecated.

ipeychev commented 10 years ago

Also, did you try with "aui-autocomplete-deprecated" module?