Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
afterComplete refresh - IE vs FF
14/03/2009
02:50
Avatar
akremedy
California, USA
Member
Members
Forum Posts: 37
Member Since:
16/12/2008
sp_UserOfflineSmall Offline

Hi, can someone tell me if, perhaps, there is a better way to handle this?  I'm displaying a grid as a subgrid, from the subgrid, I pop up a dialog with a <select> field.  The <select> options are generated dynamically onInitializeForm.  The idea is, as each option is selected and submitted, the <select> will be updated so that it no longer includes that option using afterSubmit.  This all works great in Firefox (oops, maybe not), but the behavior is very erratic in IE7. 

Actually, I just noticed that the integrity of the <select> can be broken easily by opening two subgrids, and alternating adding and deleting entries via the <select>.  I'm not completely sure, but beforeInitData seems to be handling this better than initializeForm...but only in FF.

Using version 3.4.2:

<script type=”text/javascript”>
jQuery(document).ready(function(){
    jQuery(”#users_tbl”).jqGrid({
        caption: 'Users',
        colModel :[
            {name:'uid', index:'uid', width:40, align:'center',editable:false,editoptions:{readonly:true,size:10}},
            {name:'uusrstatus', index:'uusrstatus', width: 70, align:'center',editable:true,edittype:"checkbox",editoptions:{value:"yes:no"}},
            {name:'uuser', index:'uuser', width: 100, editable:true,editoptions:{size:27}},
            {name:'upass', index:'upass', width: 100, editable:true,editoptions:{size:27},edittype:"password",editrules:{edithidden:true,searchhidden:true},hidden:true,hidedlg:true},
            {name:'uname', index:'uname', width: 200, editable:true,editoptions:{size:27}},
            {name:'uemail', index:'uemail', width: 200, editable:true,editoptions:{size:27},editrules:{email:true}},
            {name:'udate', index:'udate', width:120, hidden:true},
            {name:'ulastlog', index:'ulastlog', width:120, hidden:true}
        ],
        colNames:['ID','Enabled','Login','Password','Full Name','Email','Created','Last Login'],
        datatype: 'xml',
        forceFit: false,
        height: 220,
        imgpath: '.assets/css/images',
        mtype: 'GET',
        onHeaderClick:function(gridstate) {
            if(gridstate == 'hidden') {
                jQuery(”#groups_tbl”).setGridHeight('487px');
            } else {
                jQuery(”#groups_tbl”).setGridHeight('220px');
            }
        },
        pager: jQuery('#users_tbl_nav'),
        rowNum:10, rowList:[10,20,30],
        shrinkToFit: false,
        sortname: 'uid',
        sortorder: 'asc',
        subGrid: true,
        subGridRowColapsed:function(subgrid_id, row_id) {
        },
        subGridRowExpanded:function(subgrid_id, row_id) {
            var subgrid_table_id, pager_id;
            subgrid_table_id = subgrid_id+”_t”;
            pager_id = “p_”+subgrid_table_id;
            $(”#”+subgrid_id).html(”<div style='border:1px solid #ccc; border-bottom:1px solid #999;'><table id='”+subgrid_table_id+”' class='scroll'></table><div id='”+pager_id+”' class='scroll' style='text-align:center;'></div></div>”);
            jQuery(”#”+subgrid_table_id).jqGrid({
                datatype:”xml”,
                colModel: [
                    {name:"uid",index:"uid",width:40,align:'center',hidden:true},
                    {name:"gid",index:"gid",width:40,align:'center'},
                    {name:"gname",index:"gname",width:60,editable:true,edittype:"select",editoptions:{value:":"}},
                    {name:"gdescrip",index:"gdescrip"},
                    {name:"date",index:"date",width:80}
                ],
                colNames: ['User ID','Group ID','Group Name','Description','Added Into Group'],
                editurl:'.assets/admin_access_useraccesstbl.php',
                height:”100%”,
                imgpath:”.assets/css/images”,
                mtype: 'GET',
                pager:pager_id,
                rowNum:10,
                sortname:'gid',
                sortorder:'asc',
                url:”.assets/admin_access_useraccesstbl.php?oper=selg&id=”+row_id,
                width: 700
            }).navGrid(”#”+pager_id,
                {edit:false,search:false},
                {},
                {mtype:'POST',
                 addCaption:'Add User to Group',
                    onInitializeForm:function(formid){
                        uid=row_id;
                        $.ajax({
                            url:”.assets/admin_access_usertbl.php?oper=grpsel&uid=”+uid,
                            datatype:”script”,
                            mtype:”POST”,
                            success:function(response) {
                                $('#gname',formid).empty().html(response);
                            }
                        })
                    },
                    onclickSubmit:function(formid){
                        var retarr = {};
//                        var sr=jQuery(”#”+subgrid_table_id).getGridParam('selrow');
//                        rowData=jQuery(”#”+subgrid_table_id).getRowData(sr);
                        this.addData={”uid”:row_id};
                        retarr={”uid”:row_id};
                        return retarr;
                    },
                    afterComplete:function(formid){
                        uid=row_id;
                        $.ajax({
                            url:”.assets/admin_access_usertbl.php?oper=grpsel&uid=”+uid,
                            datatype:”script”,
                            mtype:”POST”,
                            success:function(response) {
                                $('#gname').children().remove().end().html(response);
                            }
                        })
                    }
                },
                {mtype:'POST',
                 caption:'Delete User From Group',
                    onclickSubmit:function(){
                        var sr=jQuery(”#”+subgrid_table_id).getGridParam('selrow');
                        var rowData=jQuery(”#”+subgrid_table_id).getRowData(sr);
                        this.delData={”uid”:rowData['uid'],”gid”:rowData['gid']};
                        retarr={”uid”:rowData['uid'],”gid”:rowData['gid']};
                        return retarr;
                    },
                    afterComplete:function(formid){
                        uid=row_id;
                        $.ajax({
                            url:”.assets/admin_access_usertbl.php?oper=grpsel&uid=”+uid,
                            datatype:”script”,
                            mtype:”POST”,
                            success:function(response) {
                                $('#gname').children().remove().end().html(response);
                            }
                        })
                    }
                }
            )
        },
        url:'.assets/admin_access_usertbl.php?oper=sel',
        viewrecords: true,
        width: 703
    }).navGrid('#users_tbl_nav',
        {},
        {editCaption:'Edit User',
         height:280,
         reloadAfterSubmit:false,
         url:'.assets/admin_access_usertbl.php',
         afterShowForm:function(formid){
             jQuery(”#upass”,formid).val(”");
         }
         },
        {addCaption:'Add User',
         height:280,
         reloadAfterSubmit:true,
         url:'.assets/admin_access_usertbl.php'},
        {caption:'Delete User',
         reloadAfterSubmit:false,
         url:'.assets/admin_access_usertbl.php'},
        {}
    ).navButtonAdd(”#users_tbl_nav”,
    {caption:'',
        buttonimg:'.assets/css/images/grid_cols.gif',
        onClickButton:function(){
            jQuery(”#users_tbl”).setColumns({height:280,width:280});
        },
        position:”last”,
        title:'Select columns'
    });
});
</script>

P.S.: Thanks Tony for such a fine piece of work!  jqGrid makes up about 90% of the app I'm working on - I'd be lost without it.

Adam

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
78 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information