From ff4f02827335cc0cc6925dc45f6f3e84b9edd4c0 Mon Sep 17 00:00:00 2001 From: Tommy Wang Date: Fri, 20 Aug 2010 15:16:47 +0800 Subject: [PATCH] =?utf8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=E4=B8=BB?= =?utf8?q?=E6=98=BE=E7=A4=BA=E7=95=8C=E9=9D=A2=EF=BC=8Cresponse=20?= =?utf8?q?=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8utf-8=E7=BC=96=E7=A0=81?= =?utf8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../gaixie/jibu/security/service/UserService.java | 1 - jibu-web/jibu-core-extjs/pom.xml | 3 +- .../gaixie/jibu/security/servlet/LoginServlet.java | 1 + .../gaixie/jibu/security/servlet/MainServlet.java | 4 + .../gaixie/jibu/security/servlet/UserServlet.java | 7 + .../src/main/webapp/css/jibu-all.css | 39 ++++ .../src/main/webapp/images/icons/add.png | Bin 0 -> 826 bytes .../src/main/webapp/images/icons/alert.png | Bin 0 -> 844 bytes .../src/main/webapp/images/icons/bar-chart.png | Bin 0 -> 840 bytes .../src/main/webapp/images/icons/bind.png | Bin 0 -> 465 bytes .../src/main/webapp/images/icons/cancel.png | Bin 0 -> 881 bytes .../src/main/webapp/images/icons/delete.png | Bin 0 -> 853 bytes .../src/main/webapp/images/icons/edit.png | Bin 0 -> 640 bytes .../src/main/webapp/images/icons/info.png | Bin 0 -> 865 bytes .../src/main/webapp/images/icons/line-chart.png | Bin 0 -> 606 bytes .../src/main/webapp/images/icons/pie-chart.png | Bin 0 -> 637 bytes .../src/main/webapp/images/icons/save.png | Bin 0 -> 421 bytes .../src/main/webapp/images/icons/search.png | Bin 0 -> 615 bytes .../src/main/webapp/images/icons/unbind.png | Bin 0 -> 696 bytes .../src/main/webapp/js/core/user.js | 215 +++++++++++---------- 20 files changed, 164 insertions(+), 106 deletions(-) create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/css/jibu-all.css create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/add.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/alert.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/bar-chart.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/bind.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/cancel.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/delete.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/edit.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/info.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/line-chart.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/pie-chart.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/save.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/search.png create mode 100644 jibu-web/jibu-core-extjs/src/main/webapp/images/icons/unbind.png rewrite jibu-web/jibu-core-extjs/src/main/webapp/js/core/user.js (99%) diff --git a/jibu-core/src/main/java/org/gaixie/jibu/security/service/UserService.java b/jibu-core/src/main/java/org/gaixie/jibu/security/service/UserService.java index aa5ced6..a9a047d 100644 --- a/jibu-core/src/main/java/org/gaixie/jibu/security/service/UserService.java +++ b/jibu-core/src/main/java/org/gaixie/jibu/security/service/UserService.java @@ -53,5 +53,4 @@ public interface UserService { * @return User List */ public List find(User user); - } diff --git a/jibu-web/jibu-core-extjs/pom.xml b/jibu-web/jibu-core-extjs/pom.xml index 8399860..eda7c28 100644 --- a/jibu-web/jibu-core-extjs/pom.xml +++ b/jibu-web/jibu-core-extjs/pom.xml @@ -54,7 +54,8 @@ maven-war-plugin WEB-INF/lib/*.jar,ext/** - js/** + + js/**/*.js org.gaixie.extjs-wrapped diff --git a/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/LoginServlet.java b/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/LoginServlet.java index 6cc2cdb..d66b328 100644 --- a/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/LoginServlet.java +++ b/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/LoginServlet.java @@ -49,6 +49,7 @@ import org.slf4j.LoggerFactory; public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { LoginService loginService = injector.getInstance(LoginService.class); + resp.setContentType("application/json;charset=UTF-8"); if ("login".equals(req.getParameter("ci"))) { login(loginService,req,resp); } diff --git a/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/MainServlet.java b/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/MainServlet.java index c98c713..382db61 100644 --- a/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/MainServlet.java +++ b/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/MainServlet.java @@ -50,11 +50,14 @@ import org.slf4j.LoggerFactory; public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + resp.setCharacterEncoding("UTF-8"); if ("loadMenu".equals(req.getParameter("ci"))) { AuthorityService authService = injector.getInstance(AuthorityService.class); + resp.setContentType("application/json"); loadMenu(authService,req,resp); } else { + resp.setContentType("text/html"); mainPage(resp); } } @@ -123,6 +126,7 @@ import org.slf4j.LoggerFactory; ServletUtils.css("ext/resources/css/ext-all.css")+ ServletUtils.javascript("ext/adapter/ext/ext-base.js")+ ServletUtils.javascript("ext/ext-all.js")+ + ServletUtils.css("css/jibu-all.css")+ ServletUtils.css("js/classic/layout.css")+ ServletUtils.javascript("js/classic/layout.js")+ ServletUtils.body()+ diff --git a/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/UserServlet.java b/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/UserServlet.java index f46a786..aeb7e7c 100644 --- a/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/UserServlet.java +++ b/jibu-web/jibu-core-extjs/src/main/java/org/gaixie/jibu/security/servlet/UserServlet.java @@ -31,6 +31,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.gaixie.jibu.JibuException; import org.gaixie.jibu.json.JSONArray; import org.gaixie.jibu.json.JSONException; import org.gaixie.jibu.json.JSONObject; @@ -52,6 +53,10 @@ import org.slf4j.LoggerFactory; public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + // 默认为 json类型,在初次加载时只是一个 js 片段,用text/xml + // 字符集始终用 UTF-8 + resp.setContentType("application/json"); + resp.setCharacterEncoding("UTF-8"); UserService userService = injector.getInstance(UserService.class); AuthorityService authService = injector.getInstance(AuthorityService.class); @@ -73,6 +78,7 @@ import org.slf4j.LoggerFactory; if (null ==req.getParameter("ci")) { allowed = true; + resp.setContentType("text/xml"); load(req,resp); } if (!allowed) { @@ -119,6 +125,7 @@ import org.slf4j.LoggerFactory; HttpServletResponse resp) throws IOException { Map jsonMap = new HashMap(); + ServletOutputStream output=resp.getOutputStream(); try { User user = ServletUtils.httpToBean(User.class,req); diff --git a/jibu-web/jibu-core-extjs/src/main/webapp/css/jibu-all.css b/jibu-web/jibu-core-extjs/src/main/webapp/css/jibu-all.css new file mode 100644 index 0000000..4c1025b --- /dev/null +++ b/jibu-web/jibu-core-extjs/src/main/webapp/css/jibu-all.css @@ -0,0 +1,39 @@ +.search-icon { + background-image: url(../images/icons/search.png) !important; +} +.add-icon { + background-image: url(../images/icons/add.png) !important; +} +.delete-icon { + background-image: url(../images/icons/delete.png) !important; +} +.cancel-icon { + background-image: url(../images/icons/cancel.png) !important; +} +.save-icon { + background-image: url(../images/icons/save.png) !important; +} +.bind-icon { + background-image: url(../images/icons/bind.png) !important; +} +.unbind-icon { + background-image: url(../images/icons/unbind.png) !important; +} +.pie-chart-icon { + background-image: url(../images/icons/pie-chart.png) !important; +} +.bar-chart-icon { + background-image: url(../images/icons/bar-chart.png) !important; +} +.line-chart-icon { + background-image: url(../images/icons/line-chart.png) !important; +} +.edit-icon { + background-image: url(../images/icons/edit.png) !important; +} +.info-icon { + background-image: url(../images/icons/info.png) !important; +} +.alert-icon { + background-image: url(../images/icons/alert.png) !important; +} diff --git a/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/add.png b/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/add.png new file mode 100644 index 0000000000000000000000000000000000000000..0dde83136e89eff2e9aa5d039600f871b7cb911f GIT binary patch literal 826 zcwPZI1I7G_P)?eAtgl1A`Q3^@vNIqtqnfo}MIil} zff8g9z@*f87n$sAKA7{daUBdJl#*H32uz!Ram1L z4f;dKTiqJj{@x}XrK2){r3TGgy4yU2C`n;A(A9%U|y zeMdM!%cs*2iNwZ|&_3M6yKt&$=xvKEBX#YI8*G?ol2#NO1NB(r+l~L7JH7kS^Q{G% z?8K+8*jiHiV$oR&)EjmjdEQOfn$w5`BNNybG%1Z2MU4oXUxXq!aJj1j!|{)h6&d}V zlLh3^-34XobLB7-9x0MkaY}=LYb8z>{?Oo1tIkB!xQLqQK}u{AG zxGhb!X)=N=&vG0uxX0t_*7>YRV-o)Io$3}J)vbC{!85g8D~^p1n~hVKmTh8|BMUV} zVICh02iVLWR!*kvC#zU|uBf|rn)1}M{BV5SE}Kdi%nJ@lXU0h||Jhs<@I|u?c;&LP&s#X~c=^?&VeAtju?rE*k_^coNNafsZ3veHC>09So0faeS?k;D|Np%Rd%lr= zOSC>{EnK@^03Zr)j%`0h~u=7qiW^xs47n@3ML%)NE9=Li$F zW+K4)`6oBF7G}yc%j9MOs9Ws}>fV-cwia=7s1{@;0S4qlAe4jy4?Qwma{RBC=!cih zmdEN3UUt*BU>F*YEI~pbw6i$;j)b>9hn1m52rB`pnnTG_0wl{SP;+vbX!@43IR{AM5+^|GSL}Fp9hXm6z$h@H6z)$D)9LUNp9BlLFL7po# zJ3v8MHG7ePn@KZPi@=f-C{4&$j(jLTe_$8>=);$Rk3MiBY6n#2>Qj=i^EeTUi(@UH zgO(`&KXYTDK>YrWZsNUco-t<*HsvZ7Oe}bmswxeKKS`jW{#tdF#cGs{x6XTi>0Q&*wQVgfe~xS-&xwIB ziK+8NVB_0pvqQxE-%@Qc@!Cv)*85+j#=I1hp^{)^jDx)*?{9Cz=~Kz*fYWo6#fh_j z18V3PvFUTv6oFmM`#C@7z>rh0j~zuF@BS0`!IMKqsCN3L~E5-&0?A2Om@|uysub zpAUDk+VU6!Q)kEr-{qxs8#wIFvZ}re*Fccu?C>pM&jB&3G#N6PCVe%Fxm@(q2h!$7 z%cEq8>*FEPbM`09+J3e?yq=y5SsuJg;C8{n49clywoZhW)ZTZ}#*3zF~&I-v>c?_?wV_z(Prq>Bg=I=c&NtCT(XI}L>OXhFwtNNi3m^16uX zIz-*D)4+@Jp=S7Z5v4g2O%4vg10A3y*xlx}UhDcW$T@xh8B662T?3db00000NkvXX Hu0mjfN=4uV literal 0 HcwPel00001 diff --git a/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/cancel.png b/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/cancel.png new file mode 100644 index 0000000000000000000000000000000000000000..b46bad1ac0d68d36a6ee4fa27b7c2183fae99e93 GIT binary patch literal 881 zcwPZ<1CIQOP)MG!Sgu?t?(toAm$JD0yR#x79}oQLzz_kaI)zH<&n|M^}Q79KEj z+-{<(D>390!+g+WxouNd*TcWD_|K$Yl6(qHKm9sB&g-&_Oc*0fQHW?7qIez&85v8zRb*jH?OPHIwy;q5grc}F z1_CqBMe%JEAqjzbHm6h0tEdo#y1Jl2aNcfrtumXZWhhg%+xO$EPG=RbsyBI)2_0Hk zNSN9p2vaH{ZdFmxa*yZzmcG8#@qhOn4g!9lAWc`}I;*wJMbnKm9O!G-@JD-kWCL`^ z;Yj5uYD$AKh(Swpi;LUyUcA_KE+>b}`1C0p1)qYNR*tJU&XdJ3qZ&w(Hg7K7@bcw@ zglP`Ph7cjW2*5IUw6(PK!uR?4;la+%$JlH}Ulb*4QF4RbKBMS*swj%z$|ojL{v57H z$;pR*5OSLkf^^7jqUirNJ#B|h%^vgnU5f-aY_|O}Ay0IuH{0tS-dIwyQK+d2#!2qE zT-Sbv!>4p0(H5r%BO5{`NBsVlglP>t-zZ~Trb8*oFen8@Ma}6R&mi>NGSu5Ejr8>F zG-Ml{v4D>!LZR}1cHweT(iJ5Xs-*yE$VKp?@tL4Q22h6qGO_H{v$9;9*oD^C))bni zGob{B5{;VVu`%gqM@Lm?aL`I3k>4O#B&*jOu={+sSdZro!*MEy@mw?-eTSQxnlb>h z9zuXvif9^x)Fe=WVTFGy;5Y>SXhczDq^b%W1t4a?*tfp`{bpY1O%6r400000NkvXX Hu0mjf*{_{n literal 0 HcwPel00001 diff --git a/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/delete.png b/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/delete.png new file mode 100644 index 0000000000000000000000000000000000000000..d148fb0ef2059e5513a86dcc85239e352e3adeca GIT binary patch literal 853 zcwPZj1FHOqP)R3-?8WD$lo-=N* zw}AmWIY8A^_3PsJ_{*mG`8S*6+5d-+MMbAvUhm_zr6sIRO+m8RKmgEr9ytdO!XeAQ z7XALZ`cPUE?Usm9%*(^kKmZ?(9Ybn~M`OGmPE$crK~Y z=pD0Op6b<8DVz+2;L6V4;P$tX5xlFc1W)&-ClZx777iD)-ptHfoUUIL2*75VLPjM> zNelU)P>{L4`~7%PR)&nMENDcc5&)z4U@BF^x}45-V(&89ZM0M2FiP6nQP?HO4>M9hH|NQuI1Yf@fM9dRi8BHWezL@|5 zFjUprqAZ`h9*aHQ@D>IJ2Md44>UoNde<{ULom*Sq23$T~(t7Jt$~egyO<> fyFJ+4-2CMaxz0#LJDSE;00000NkvXXu0mjf6Pl0K literal 0 HcwPel00001 diff --git a/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/edit.png b/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/edit.png new file mode 100644 index 0000000000000000000000000000000000000000..b8e8a83ddc9a3c0be3b96f948a762086ca77db69 GIT binary patch literal 640 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 XyO~Q)Hd=_Q00000NkvXXu0mjfT4E;a literal 0 HcwPel00001 diff --git a/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/save.png b/jibu-web/jibu-core-extjs/src/main/webapp/images/icons/save.png new file mode 100644 index 0000000000000000000000000000000000000000..19d00b103f3427d2d2e069af9753a923371b220f GIT binary patch literal 421 zcwPae0b2fvP))z&kRcLq1FBLD8Qeu4 z5M{v5Hwp}Gv(JMJh=d#9?XAnOAcBu50}@tzV%WO%GRS}gxB+%9IteX1|-1^FtpKT*p)6olmTutKQNp>auwA8RWmJyInK|CG9YEIB*X1f*H8_RGSFmT zW@2OjA~0qIVFm~d0)PK8F#P)u!GD3ovkTWz4Ujk1VqgaH{{F{r08GupvuG|*HU%2M z#K3UteZ_Z+S=L-At51f%_1>J7_=<4 z8U6sB0f$hZz7$!<<0u2*m6_%tSyx&gNuvOO$0ks zMIj=HnnBRUR?tKXG11rxCU4&7dG4NbuvR2_mEvc)n?Cow;~Wve|KR^>9@p5l)|QB+ z$jmun3q#x>;ss-PW_mnr2MHVzLAl1RW&0?VkixF*4t!St0YVb2wnKdU(kmOHiL;aW zK8Xte%(k>MVGG$E4no6dcNnb>BhVHHGD&1pv4YZ68kE2V03t5#PCEFm7=ad$6)+3B zTCmn*?A?=u(o~ET7~-7g0)ZB=6|lumi4}B}MLgy~Ysy6)Q5%Al7|05&1z3Jpu>cF8 z3?VXs*3<}%h3`5Wld)N2zJnk%Agw<~3k)sPTLFd=F5;d8-bj-09SkQuynfflNcZLN z!^_37fdZvzrq=9~mp*($%mcDRKC&qvaaZuX+C=AT6O*~tHl>0mcP<_q>-z%$xO(@! zYluq5a8VQI$S@4?r*v;gPo!QQ%pX3A#>xx4t=w-L6COWx?aj&`f+!YePsFtj=hOQR zP3=E2j@9L7s8;T^&s?u(Hdpu?CubjMrGn{t_37>9$|AD)QE08weJlKn8|OyjL~7oP zC8mPT`jzuH*Dh^I0048RGafUIT)4H~*m8m>egI0iH=(LB%b@@O002ovPDHLkV1lw0 B3i9)OMYN(T5nbrgDmErf1EF;zlSGkjsumZ5AQYsMg)Ler(htRjN(&W= ze>dzWi)zsJ*DA;JRTm>hi@hw1sB z;OncCRt1o3!Q|w}R4UpK42EW1uKNc(o*VdT@y_scMyz5*3!lEG;X^D554+70rp9sy z?6KY6u*qn&{E+3b)1goZ*Y-5Ej?Rc{8SL1)4$@f#mJ@k+&}DM+k|HI6Vr>Y+Bb&{R z!@{LT;TRIh}>TS1HM@$r)Z$6I(%Q2VQwJ-o?gptPNF?W zrX;D^APDLqpYH$?zmWUx@~ zfNGVAhz}GBNJb2Io5^+x$!wb_9-m7jUP~h*Pq=_8lN3-T zWzhE7!+!roe|^1myC|CCx!fqWI#?25S8hJ18qqdDzq`iCFAJ^Z5U-{kj$W*}9plgV zpV*N6hPU|_2^g++zEJSv(9?EQ;*MT&a-Iv3-D(oxUD?0|iVlp3^$07E#}QeC%*mCv eROf=l8~O*$b{RUxhiy#&0000 0){ - return '' + val + ''; - }else if(val < 0){ - return '' + val + ''; - } - return val; - } - - /** - * Custom function used for column renderer - * @param {Object} val - */ - function pctChange(val){ - if(val > 0){ - return '' + val + '%'; - }else if(val < 0){ - return '' + val + '%'; - } - return val; - } - - // create the data store - var store = new Ext.data.ArrayStore({ - fields: [ - {name: 'company'}, - {name: 'price', type: 'float'}, - {name: 'change', type: 'float'}, - {name: 'pctChange', type: 'float'}, - {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'} - ] - }); - - // manually load local data - store.loadData(myData); - - // create the Grid - var grid = new Ext.grid.GridPanel({ - store: store, - columns: [ - {id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'}, - {header: 'Price', width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'}, - {header: 'Change', width: 75, sortable: true, renderer: change, dataIndex: 'change'}, - {header: '% Change', width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'}, - {header: 'Last Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'} - ], - stripeRows: true, - autoExpandColumn: 'company', - height: 350, - width: 600, - title: 'Array Grid', - // config options for stateful behavior - stateful: true, - stateId: 'grid' - }); - - mainPanel.getActiveTab().add(grid); - mainPanel.getActiveTab().doLayout(); -}); +Ext.ns('jibu.security.user'); + +jibu.security.user.SearchGrid = function(config){ + Ext.apply(this, config); + this.store = new Ext.data.JsonStore({ + // destroy the store if the grid is destroyed + autoDestroy: true, + + url: '/UserServlet.z?ci=find', + root: 'data', + fields: [ + {name: 'id', type: 'int'}, + {name: 'username', type: 'string'}, + {name: 'password', type: 'string'}, + {name: 'fullname', type: 'string'}, + {ame: 'emailaddress', type: 'string'}, + {name: 'enabled', type: 'bool'}], + sortInfo: {field:'username', direction:'ASC'} + }); + this.sm = new Ext.grid.CheckboxSelectionModel(); + this.columns = [ + {header: 'Username', width: 160, sortable: true, dataIndex: 'username'}, + {header: 'Full Name', width: 160, sortable: true, dataIndex: 'fullname'}, + {header: 'Email Address', width: 200, sortable: true, dataIndex: 'emailaddress'}, + {header: 'Enabled', width: 75, sortable: true, dataIndex: 'enabled'}, + this.sm]; + this.tbar = [{ + xtype : 'combo', + name : 'searchType', + width: 130, + emptyText: 'Select a property...', + store: new Ext.data.ArrayStore({ + fields: ['prop', 'displayText'], + data: [ + ['User.username', 'Username'] + ] + }), + valueField : 'prop', + displayField:'displayText', + mode: 'local', + scope: this, + triggerAction: 'all' + },{ + text: '=' + },{ + xtype: 'field', + name: 'searchValue', + scope: this + },{ + xtype: 'button', + text: 'Search', + scope: this, + iconCls :'search-icon', + handler : this.searchUserFun + }]; + + // paging bar on the bottom + this.bbar = new Ext.PagingToolbar({ + pageSize: 25, + store: this.store, + displayInfo: true, + displayMsg: 'Displaying topics {0} - {1} of {2}', + emptyMsg: "No topics to display", + items:[ + '-', + { + enableToggle:true, + text: 'Add User', + iconCls: 'add-icon', + toggleHandler: function(btn, pressed){ + } + },{ + enableToggle:true, + text: 'Delete User', + iconCls: 'delete-icon', + toggleHandler: function(btn, pressed){ + } + }] + }); + + jibu.security.user.SearchGrid.superclass.constructor.call(this,{ + stripeRows: true, + height: 350, + width: 800, + border: false + }); + +}; + +Ext.extend(jibu.security.user.SearchGrid,Ext.grid.GridPanel,{ + searchUserFun : function(btn,event){ + var key = this.getTopToolbar().find('name','searchType')[0].getValue(); + var value = this.getTopToolbar().find('name','searchValue')[0].getValue(); + var params = {start:0,limit:25}; + params[key]=value; + this.getStore().load({ + scope:this, + params:params, + callback:function(records,o,success){ + console.log(success); + } + }); +// console.log(params); + } + }); + +Ext.onReady(function() { + var searchGrid = new jibu.security.user.SearchGrid(); + mainPanel.getActiveTab().add(searchGrid); + mainPanel.getActiveTab().doLayout(); + }); -- 2.11.4.GIT