Forum

July 12th, 2025
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
edittype:select not showing the labels
20/05/2011
16:49
Avatar
ledy
New Member
Members
Forum Posts: 1
Member Since:
20/05/2011
sp_UserOfflineSmall Offline

Hi,

Using the current version of jqgrid with the latest jquery library, I worry about my datagrid having some bugs. I compared each line with the demo/examples and manual, but cannot find out what's wrong.

I use edittype:select in the datagrid with some editoptions:{"shortID:Long Label;mo:re"}. When adding a new row or edit+save an existing one, the table is showing the "Long Label".

But by default, after loading the table, i can not see the labels, but the values, e.g. shortID instead of LongLabel.

Refresh/Reload does not help.

I suspect my load function to be the failure source:

    var myData = ... ;//a javascript {"1":{"ruleid":"1",...}}
    $.each(myDatafunction(k,v)
    {
         jQuery("#rules-edit").jqGrid('addRowData',"ruleid"+v.ruleid,v);
    });

Thanks for help.

PS: That's the entire source:

<script src="js/jquery.layout.js" type="text/javascript"></script>
<script src="./js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script type="text/javascript">
    $.jgrid.no_legacy_api = true;
    $.jgrid.useJSON = true;
</script>
<script src="./js/jqgrid/js/ui.multiselect.js" type="text/javascript"></script>
<script src="./js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="./js/jqgrid/js/jquery.tablednd.js" type="text/javascript"></script>
<script src="./js/jqgrid/js/jquery.contextmenu.js" type="text/javascript"></script>
<script src="./js/jqgrid/plugins/jquery.searchFilter.js" type="text/javascript"></script>

<script>
function datagrid_export(jqgrid_id)
{
    return jQuery("#"+jqgrid_id).jqGrid('jqGridExport',{exptype:'jsonstring',jsonGrid : "data"});
}
</script>
<!--/datagrid-->

<div class="datagrid-box">
<table id="rules-edit"></table>
<div id="rules-edit-pager"></div>

<script>
var jqgsel;
jQuery("#rules-edit").jqGrid({
    datatype: "local",
    pager:"#rules-edit-pager",
    pgbuttons:false,
    pginput:false,
    rowNum:500,
    sortname:"ruleid",
    sortorder: "desc",
    viewrecords: false,
    autowidth: false,
    hidegrid: false,
       colNames:['RuleID','On'],
       colModel:[
           {name:'ruleid',index:'ruleid',width:50,editable:false},
           {name:'active',index:'active',width:30,editable:true,edittype:"select",editoptions:{value:"0:Off;1:On"}}
       ],
    afterInsertRow:function(rowid,rowdata,rowelem){
        if(!rowdata.ruleid)
            window.location.reload();
    },
    editurl: "./?script=campaign&sub=rules&todo=save&ajax=1",
    caption: "Test"
});
jQuery("#rules-edit").jqGrid('navGrid','#rules-edit-pager',{del:false,add:true,edit:true,search:false})

$(function(){
    var json_data ={"1":{"ruleid":"1","active":"0","ts":"2011-05-20 13:37:50"}};
    $.each(json_data,function(k,v)
    {
         jQuery("#rules-edit").jqGrid('addRowData',"ruleid"+v.ruleid,v);
    });
 });
 </script>

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
16 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