EasyUI Forum

General Category => General Discussion => Topic started by: anugrast on September 24, 2016, 11:20:01 PM



Title: Panel queryParams
Post by: anugrast on September 24, 2016, 11:20:01 PM
I've tried to open my panel with a href onclick that run js function. I want to sent parameter to that panel.

This is my code:

HTML:
Code:
<a href="#" onclick="linknya('url','jumod','ikon','pilih:1')">Open Panel</a>

JS:
Code:
function linknya(myurl,jumod,ikon, param) {
$('#panelDetail').panel({ fit:true, title:jumod, iconCls:ikon, href: myurl, queryParams: {param} });
}

How to get my queryParams on myurl page ?

Please help me....
Thx


Title: Re: Panel queryParams
Post by: jarry on September 25, 2016, 03:15:47 PM
The queryParams can not be set as a string, it should be a key-value pair. Please try this code.
Code:
queryParams:{
  pilih: 1
}


Title: Re: Panel queryParams
Post by: anugrast on September 25, 2016, 06:29:32 PM
Solved... at least for me...  :)

I've re-create parameters to array then sent them as queryParams

HTML
Code:
       <a href="#" onclick="linknya('url','jumod','ikon','pilih:1')">Open Panel</a>

JS
Code:
function linknya(myurl,jumod,ikon, parameter) {
var param=[];
var arr1 = parameter.split(",");
var jum1 = arr1.length;
for (i = 0; i < jum1; i++) {
arr2 = arr1[i].split(":");
var key = arr2[0];
var val = arr2[1];
param[key] = val;
}
        $('#panelDetail').panel({ fit:true, title:jumod, iconCls:ikon, href: myurl, queryParams: param });
}

Thanks...