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_Related Related Topics sp_TopicIcon
cellEdit + setGridParam data + sort
06/09/2010
20:34
Avatar
ezhidze
New Member
Members
Forum Posts: 1
Member Since:
06/09/2010
sp_UserOfflineSmall Offline

Hi!

I'm trying to made a local data self-expandible table with cellEdit and auto-sorting.

I.e. last row of the table is always blank, and when user fills the first cell in that line, table must reorder itself and add a blank row at the end. After every edit the hidden input's value must be set to ensure that I can catch entrie array via $_POST.

While I experimented with just 'clientSide', all was almost good – except for one thing: when reordering the data in the lines were mixed in some strange order.

Then I formed data array, and set .setGridParam({ data: … }) to it.

Row adding still works, but data isn't saved anymore.

Second question is how I can made table hard order itself by the first column (len) without letting user to sort any othe way?

<table id="pr3tbl1″></table>

<br><textarea name="table1input" id="table1input" cols="55″></textarea>

<script type="text/javascript">

var pr3mdl1 = new Array ();
pr3mdl1[0] = {name:'len',index:'len',label:'Len,"', width:60, sortable:true, sorttype:'int', resizable:false, editable:true,editrules:{number:true}};

var lastCol = 3;
for(var i=1;i<=9;i++) {
    pr3mdl1[i] = {name:'w'+i,index:'w'+i,label:"Col "+i, width:45, sortable:false, resizable:false, editable:true, editrules:{number:true}, hidden: (i > lastCol)}
}

pr3tbl1Grid = jQuery("#pr3tbl1″).jqGrid({
    datatype: "clientSide",
    colModel: pr3mdl1,
    loadonce: true,
    height: "100%",

    cellEdit: true,
    cellsubmit: 'clientArray',

    viewsortcols: [false,'vertical',false],

    caption:"Length, yd:",

    sortname: 'len',
    sortorder: 'desc',

    afterSaveCell:  function(rowid,celname,value,iRow,iCol) {
        if(this.reccount <= rowid) {
            rowLen = jQuery("#"+this.id).getCell(rowid, 'len');
            if (rowLen != "") {
                jQuery("#"+this.id).setGridParam({sortname:'len'}).trigger('reloadGrid');
                jQuery("#"+this.id).addRowData(this.reccount + 1,{len:"",w1:"",w2:"",w3:""},'last');
            }
        }
        jQuery("#table1input").val(pr3tbl1Data.toJSON());
    }
});

var pr3tbl1Data = [
    {len:"24",w1:"1",w2:"35",w3:"24.24"},
    {len:"50",w1:"2",w2:"35",w3:"50.50"},
    {len:"45",w1:"3",w2:"45",w3:""},
    {len:"",w1:"",w2:"",w3:""}
];

pr3tbl1Grid.setGridParam({ data: pr3tbl1Data });
pr3tbl1Grid[0].refreshIndex();
pr3tbl1Grid.trigger("reloadGrid");

</script>

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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