jQWidgets Forums

jQuery UI Widgets Forums Grid jqxGrid, jqxWindow & exposing click event to jQuery mobile popup

This topic contains 1 reply, has 1 voice, and was last updated by  jas- 11 years, 6 months ago.

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

  • jas-
    Member

    I am attempting to expose the click event handler within jqxGrid to jQuery-mobile $.popup() vs. $.jqxWindow() is this possible? Here is the grid configuration. Any pointers, tips & examples are appreciated.

    The entire file can be found @ https://github.com/jas-/MLIB-Inventory/blob/master/js/inventory.js

    /* create jqxGrid for specified data */
    function doGrid(element, obj)
    {
    	var adapter = new $.jqx.dataAdapter(obj.source);
    
    	$("#"+element).jqxGrid({
    		altrows: true,
    		autoheight: true,
    		autosavestate: true,
    		autoshowloadelement: true,
    		autoloadstate: true,
    		columns: obj.columns,
    		editable: true,
    		filterable: true,
    		groupable: true,
    		pageable: true,
    		pagesizeoptions: ['5', '10', '20', '30', '40', '50'],
    		ready: function () {
    			$('#'+element).jqxGrid('loadstate', $('#'+element).jqxGrid('getstate'));
    		},
    		renderstatusbar: function (statusbar) {
    			statusbar.append(getBtns(element, statusbar));
    		},
    		selectionmode: 'singlecell',
    		showfilterrow: true,
    		showstatusbar: true,
    		showtoolbar: true,
    		source: adapter,
    		sortable: true,
    		updaterow: function (rowid, rowdata, commit) {
    			/* update record */
    			commit(true);
    		},
    		width: '100%'
    	});
    }
    
    function getBtns(element, obj)
    {
    	var AddBtn = genAddBtn();
    
    	var container = genBtnContainer();
    
    	container.append(AddBtn);
    
    	btnEvents(element, AddBtn);
    
    	return container;
    }
    
    function btnEvents(element, AddBtn)
    {
    	AddBtn.jqxButton({
    		width: 65,
    		height: 20
    	}).click(function(event) {
    		launchModel($('#config').data('config'));
    	});
    
    }
    
    function launchModel(config) {
    	$('#'+config.page).popup();
    }
    
    function genBtnContainer()
    {
    	return $("<div style='overflow: visible; position: relative; margin: 5px;'></div>");
    }
    
    /* Add button */
    function genAddBtn()
    {
    	return $("<div style='float: left; margin-left: 5px;'>"+
    							"<a href='#add-computer' data-rel='popup' data-position-to='window' data-role='button' data-inline='true'>"+
    								"<img style='position: relative; margin-top: 2px;' src='../images/add.png'/>"+
    								"<span style='margin-left: 4px; position: relative; top: -3px;'>"+
    									"Add"+
    								"</span>"+
    							"</a>"+
    						"</div>");
    }

    jas-
    Member

    Mark as solved. I had my syntax wrong for the $(‘#selector’).popup(‘open’) call to the

    attributes necessary for the jquery-mobile $.popup() functionality.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.