jQWidgets Forums

jQuery UI Widgets Forums Navigation Tree Give message for empty tree

This topic contains 1 reply, has 2 voices, and was last updated by  Nadezhda 10 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Give message for empty tree #60799

    sathiyaseelan8
    Participant

    hi,

    i did a function using jqxtree(JSON) and its working fine.

    i need to know how to display a message, when there is no data to display in jqxtree.

    example message: no data to display.

    here is my code

    <script type="text/javascript">
                $(document).ready(function () {
    				var theme = 'ui-redmond';
    				
    				$('#submit').click(function() {
    					//validate fields
    					
    					if(document.getElementById('txt_input').value == '')
    					{
    						alert("Please enter a value");
    					}
    					else
    					{
    						disp_tree();
    					}
    				});
    				
                    // prepare the data
                var disp_tree = function() {
    				$('#jqxWidget').html('<img src="js/jqwidgets/resources/loader_2.gif"><img>');
    			
    				var search = document.getElementById('txt_input').value;
    				var cate = document.getElementById('ddl_list').value;
    				
    				var source =
    					{
    						datatype: 'json',
    						datafields: [
    							{ name: 'id' },
    							{ name: 'parentid' },
    							{ name: 'text' },
    							{ name: 'value' }
    						],
    						//theme: theme,
    						url: 'tree_view.php?search='+search+"&cate="+cate,
    						id: 'id',
    						root: 'data',
    						async: false
    					};
    					// create data adapter.
    					var dataAdapter = new $.jqx.dataAdapter(source);
    					// perform Data Binding.
    					dataAdapter.dataBind();
    					// get the tree items. The first parameter is the item's id. The second parameter is the parent item's id. The 'items' parameter represents 
    					// the sub items collection name. Each jqxTree item has a 'label' property, but in the JSON data, we have a 'text' field. The last parameter 
    					// specifies the mapping between the 'text' and 'label' fields.  
    					var records = dataAdapter.getRecordsHierarchy('id', 'parentid', 'items', [{ name: 'text', map: 'label'}]);
    					$('#jqxWidget').jqxTree({ source: records, width: '300px'});
    				};
                });
        </script>

    thank you.

    Give message for empty tree #60825

    Nadezhda
    Participant

    Hello sathiyaseelan8,

    Unfortunately, there is no way to display a message.

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.