Hello stworthy,
I've used the portal extension to build a widget with a datagrid view inside the panel....
The file sampleGrid.jsp is just having a normal datagrid from your demo...
The following line is written in the javascript:
var panels = [
{id:'p5_1',title:'Data Grid',height:200,collapsible:true,closable:true,maximizable:true,href:'sampleGrid.jsp'},
//other json strings ];
On choosing the checkbox from the combox option in the html page, I've called the function to add a panel containing the datagrid to the portal application.
The following line is one of the options that i've written in the combobox dropwdown:
<input type="checkbox" name="lang" id="widget_chkBox_p5_1" value= '{"id":"p5_1","title":"Data Grid","height":200,"collapsible":true,"closable":true,"maximizable":true,"href":"sampleGrid.jsp" }' /><span>Datagrid Sample</span><br/>
These are the functions that i've called and defined in the document ready section:
//function to show the panel in the portal
$('#widget_chkBox_p5_1').click(function(event) {
$.showWidgetPanel("pp_1",this);
});
//function that will check the checkbox value before creating the new panel
jQuery.showWidgetPanel = function(div_id, chkbox_element)
{
if(chkbox_element.checked)
{
$.addWidgetToPanel(div_id, chkbox_element.id);
}
};
//function to actually add the widget to the portal panel
jQuery.addWidgetToPanel = function(div_id, panel_id) //@param1: the current selected tab value & @param2: the checkbox id
{
var options = $.getPanelOptions(panel_id);
if (options)
{
var p = $('<div/>').attr('id',options.id).appendTo("#"+div_id);
p.panel(options);
//normal call to the portal to add the new panel
$("#"+div_id).portal('add',{
panel:p,
columnIndex:'0'
});
$('#'+options.id).panel({
onMaximize: function(){
var opts = $('#'+options.id).panel('options');
var p = $('#'+options.id).panel('panel');
opts.fit = false;
opts.stub = $('<div></div>').insertAfter(p);
p.appendTo('body').addClass('max');
$('#'+options.id).panel('resize', {
width: $(window).width(),
height: $(window).height()
});
},
onRestore: function(){
var opts = $('#'+options.id).panel('options');
var p = $('#'+options.id).panel('panel');
p.insertAfter(opts.stub).removeClass('max');
opts.stub.remove();
p.parent().removeClass('panel-noscroll');
}
});
}
};
//This is the modified getPanelOptions function
jQuery.getPanelOptions = function(id)
{
for(var i=0; i<panels.length; i++)
{
if (panels[i].id == id)
{
return panels[i];
}
}
if($('#'+id).length > 0)
{
return $.parseJSON($('#'+id).val()); //getting checkboxes value and parsing it to JSON
}
return undefined;
};
I'm most probably getting the error in the part when I'm adding the widget in the addWidgetToPanel() function. But the error is coming in the jquery,easyui.min.js file
Thanks and regards,
Darrel Viegas.