Ext.Net Grid Checkbox Column Problem

  1. #1

    Ext.Net Grid Checkbox Column Problem

    Hi ........

    I am Facing a problem while using ext grid panel with a checkbox column inside it. Assigned DataIndex datatype as boolean and its working fine when binding Boolean Data.But the problem is when I'm using oracle as backend (There is no Boolean Datatype,hence used char)....
    Anyway i want to bind the data from DB in Grid..All other fields get binded..except checkbox....

    Is there any other option to set the checkbox checked , unchecked based on a char value while binding Grid with the store...?


    Pls Help...............................
  2. #2
    Vladimir Shcheglov
    Sr. Developer
  3. #3

    CheckBox Binding Problem in side Grid

    Hi Viladimir ....

    Thanks for your reply........

    I tried as shown in the sample..but still now i cant overcome


                DataTable table1 = new DataTable("GridTable");
                DataColumnCollection columns1 = table1.Columns;
    
                DataColumn Column1 = columns1.Add(ID_FIELD, typeof(System.Int32));         
                columns1.Add(FORMNAME_FIELD, typeof(System.String));
                columns1.Add(ADDRIGHTS_FIELD , typeof(System.Boolean   ));
    
    
    
                   <ext:RecordField Name="FORMNAME" />
                 <ext:RecordField Name="addrights" Type ="Boolean"   >
                   <Convert Handler="return value === 'Y';" />
                   </ext:RecordField> 
    
                 Returned Datatable From DB
    
                   /----------------------------/
    
                    N	1	New Mail Entry
                    Y	2	Mail View
                    Y      3	Mail Attachment Details
    
                   /------------------------------/
    
          But still i cant achieve it in screen...when i see in explorer ,checkbox remains unchecked....
  4. #4
    Well, in this case, i guess you bind data without that values
    Please check your DataTable before binding. Are sure that the following line is correct?
    columns1.Add(ADDRIGHTS_FIELD , typeof(System.Boolean));
    I don't think that 'typeof(System.Boolean)' is required if you return 'char' from DB
    Vladimir Shcheglov
    Sr. Developer
  5. #5
    i have used conversion in oracle query and tried converting it to a char value

    SELECT TF.formid,TF.FormName,decode(TR.addrights,1,'Y',0,'N') as addrights FROM tblformdetails TF
    Even it returns a char value , as shown in my previous example , it does not affect the CheckBox Column

    Even i tried without typed Dataset, it doesn't affect

      OleDbCommand command = new OleDbCommand("CRUD_Sample.GetSampleData");
                    command.Connection = oracleConn;
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("p_id", OleDbType.Integer).Value = UserID;
                    OleDbDataAdapter da = new OleDbDataAdapter(command);
                    da.Fill(ds, "TblModulesForms");
    Binding Grid as follows.....
        
               Store1.DataSource =ds.Tables[0];
                Store1.DataBind();
  6. #6
    How values are represented in DataTable before binding?
    Also, how the data is serialized (you can find it in the browser source page)
    Vladimir Shcheglov
    Sr. Developer
  7. #7
    Data Table........


    1 New Mail Entry N N N
    2 Mail View N N N
    3 Mail Attachment Details Y N N




    Page Source
    //<![CDATA[
    Ext.net.ResourceMgr.init({id:"ctl06",BLANK_IMAGE_U RL:"/mms/extjs/resources/images/default/s-gif/ext.axd",aspForm:"frmApprovalRequestList",theme:"b lue",appName:"mms",icons:["UserSuit","User"]});Ext.onReady(function(){Ext.QuickTips.init();new Ext.net.Viewport({id:"Viewport1",renderTo:"frmAppr ovalRequestList",items:[{store:this.Store1=new Ext.ux.data.PagingStore({proxyId:"Store1",autoLoad :true,reader:new Ext.data.JsonReader({fields:[{name:"PKID"},{name:"FORMID"},{name:"FORMNAME"},{n ame:"ADDRIGHTS",type:"boolean",convert:function(va lue,record){return value === 'Y';}},{name:"VIEWRIGHTS",type:"boolean",convert:f unction(value,record){return value === 'Y';}},{name:"DELRIGHTS",type:"boolean",convert:fu nction(value,record){return value ==='Y';}}],idProperty:"PKID"}),refreshAfterSave:"None",direc tEventConfig:{},proxy:new Ext.data.PagingMemoryProxy({}),beforeLoadParams:fu nction(store,options){if (!options.params){options.params = {};};Ext.apply(options.params,{});Ext.applyIf(opti ons.params,{"start":0,"limit":20});}}),id:"GridPan el1",columnPlugins:[3,4,5],xtype:"netgrid",autoHeight:true,margins:"0 0 5 5",region:"center",width:800,bbar:{id:"PagingToolb ar1",xtype:"ux.paging",displayInfo:true},frame:tru e,iconCls:"icon-usersuit",title:"Role Rights Settings",loadMask:{showMask:true},view:this.GridV iew1=new Ext.grid.GridView({proxyId:"GridView1",forceFit:tr ue,listeners:{beforerefresh:{fn:clean}}}),memoryID Field:"PKID",cm:this.ColumnModel1=new Ext.grid.ColumnModel({proxyId:"ColumnModel1",colum ns:[{dataIndex:"PKID",header:"PKID",hidden:true},{data Index:"FORMID",header:"Form ID",hidden:true},{dataIndex:"FORMNAME",header:"Doc ument"},{align:"center",dataIndex:"addrights",head er:"Add",width:30,editable:true,xtype:"checkcolumn "},{align:"center",dataIndex:"viewrights",header:" View",width:30,editable:true,xtype:"checkcolumn"}, {align:"center",dataIndex:"delrights",header:"Dele te",width:30,editable:true,xtype:"checkcolumn"}]}),listeners:{command:{fn:function(command,record, rowIndex,colIndex){NAVopen(record.data.FormDetail, record.data.TransactionID);}}}},{id:"FormPanel1",x type:"form",defaultAnchor:"100%",margins:"0 5 5 5",region:"east",split:true,width:280,items:[{id:"RoleCombo",xtype:"combo",fieldLabel:"Role",da taIndex:"ROLEID",emptyText:"Select a Role..",displayField:"ROLE",hiddenName:"RoleCombo_ Value",mode:"local",queryDelay:10,shadow:"drop",tr iggerAction:"all",valueField:"ROLEID",store:this.S tore2=new Ext.ux.data.PagingStore({proxyId:"Store2",autoLoad :true,reader:new Ext.data.JsonReader({fields:[{name:"ROLEID"},{name:"ROLE"}],idProperty:"ROLEID"}),directEventConfig:{},proxy: new Ext.data.PagingMemoryProxy([{"ROLEID":1.0,"ROLE":"Admin"},{"ROLEID":2.0,"ROLE" :"Mgr"},{"ROLEID":3.0,"ROLE":"Supervisor"},{"ROLEI D":4.0,"ROLE":"SuperUser"}], false)}),submitValue:true,directEvents:{select:{fn :function(item,record,index){var params=arguments;Ext.net.DirectEvent.confirmReques t({control:this,action:'Select'});},delay:20}}},{i d:"Button1",postback:{"eventName":"click","fn":fun ction(){window.location = 'javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("Button1", "", true, "", "", false, true))';}},xtype:"button",region:"west",width:70,t ext:"Save",directEvents:{click:{fn:function(item,e ){var params=arguments;Ext.net.DirectEvent.confirmReques t({extraParams:{"Grid1":Ext.encode(GridPanel1.getR owsValues({selectedOnly : false}))},control:this});},delay:20}}},{id:"HTxtRo wSelect",xtype:"hidden"}],frame:true,iconCls:"icon-user",renderFormElement:false,url:"/mms/Modules/Configurations/ApprovalRequestList.aspx"}],layout:"border"});new Ext.form.Hidden({id:"HTxtFormID",renderTo:"HTxtFor mID_Container"});new Ext.form.Hidden({id:"HTxtTransactionID",renderTo:" HTxtTransactionID_Container"});new Ext.form.Hidden({id:"HTxtPKID",renderTo:"HTxtPKID_ Container"});new Ext.form.Hidden({id:"HTxtNavigation",renderTo:"HTx tNavigation_Container"});});
    //]]>
  8. #8

    I Got it........

    Thanks a lot ........

    I got the Solution ...In fact Data Index Name in Column Model Was misspelled...I missed it while trying with diferent Data type...


    Really you doing a nice job Viladimir...thx.

Similar Threads

  1. Replies: 5
    Last Post: Dec 26, 2011, 5:39 AM
  2. Replies: 3
    Last Post: Aug 12, 2011, 5:56 PM
  3. Replies: 2
    Last Post: Mar 22, 2011, 3:40 PM
  4. [CLOSED] Problem using CheckBox as a Filter column.
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 13, 2010, 1:19 PM
  5. Replies: 3
    Last Post: Nov 19, 2009, 9:17 AM

Posting Permissions