Wednesday, September 21, 2016

How to activate / inactivate Portlet in LIferay

1. Login as Liferay Administrator

2. Navigate to Plugins Configuration
    Control Panel > Apps > Plugins Configuration

3. Click on 1 of the plugin from the list, eg. Documents and Media

4. untick the "Active" checkbox.

5. Save.

With these steps, the Documents and Media portlet/plugin has been deactivated.


Done!!

Tuesday, September 20, 2016

How to get size of a java collection in xhtml

Basically there are 2 ways to get the size of a collection / list in xhtml.
1. jstl function
#{ fn:length(myList) }
2. call the size() function directly
#{ myList.size() }

Done!!

Tuesday, August 2, 2016

PrimeFaces fileUpload javascript properties

fileuplaod_wgt.buttonBar.find("button.cancel")
fileuplaod_wgt.buttonBar.find("button.start")
fileuplaod_wgt.buttonBar.find('input[type=file]')

upload content
upload.uploadContent'

number of uploaded files
var files = fileuplaod_wgt.uploadContent.find('.files .template-upload');

invalid files
fileuplaod_wgt.uploadContent.find("tr.ui-state-error");



reference:
http://stackoverflow.com/questions/14881131/primefaces-upload-how-to-only-allow-one-upload-in-advance-mode

Monday, June 27, 2016

How to disable Choose button in PrimeFaces fileupload component


The javascript function is to disable "Choose" button in <p:fileUpload /> component a file has been uploaded.
It is applicable to PrimeFaces 3.5

function below will find the Choose button from the passed in widgetVar when the file component onchange,
if the number of uploaded files more than 1,
disable the Choose button.


<script type="text/javascript">

    function onchangeDisableChooseBtn(upload_widget_var) {
        if(upload_widget_var.buttonBar.find('input[type=file]').get(0).type == 'file') {
            upload_widget_var.buttonBar.find('input[type=file]').change(function() {
                var files = upload_widget_var.uploadContent.find('.files tr');
                if (files.length >= 1) {
                    upload_widget_var.buttonBar.find('input[type=file]').get(0).disabled=true;
                }
                onchangeDisableChooseBtn(upload_widget);
            });
        }
    }

</script>



Done!!

Wednesday, June 22, 2016

How to hide icons in PrimeFaces fileUpload component.

PrimeFaces version: 3.5

to hide icon in choose button

  .fileupload-buttonbar .fileinput-button .ui-icon-plusthick{
         display: none !important;
 }


to hide icon in upload button

 .fileupload-buttonbar .start .ui-icon-arrowreturnthick-1-n{
         display: none !important;
 }


to hide icon in cancel button


 .fileupload-buttonbar .cancel .ui-icon-cancel{
         display: none !important;
 }




Done!!

LinkWithin

Related Posts Plugin for WordPress, Blogger...