jQuery UI Widgets Forums Grid Grid JS error on LoadState

This topic contains 17 replies, has 4 voices, and was last updated by  Dimitar 7 years, 7 months ago.

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
  • Grid JS error on LoadState #64218

    sjkcwatson
    Participant

    I have a grid

    $(“#jqxgrid”).jqxGrid({
    theme: ‘OriasBlue’,
    width: ‘100%’,
    height: 550,
    source: gridDataAdapter,
    sortable: true,
    pageable: true,
    autoheight: true,
    columnsresize: true,
    pagesize: 20,
    pagesizeoptions: [’10’, ’20’, ’30’,’50’,’100′,’250′,’500′,’1000′],
    pagermode: ‘default’,
    localization: getLocalization(),
    showfilterrow: true,
    filterable: true,
    altrows: true,
    editable: false,
    enablekeyboarddelete: false,
    showrowdetailscolumn: true,
    selectionmode: ‘singlerow’,
    rowdetails: true,
    autoloadstate: false,
    autosavestate: false,
    rowdetailstemplate:
    {
    rowdetails: “<div style=’margin: 10px;’><ul style=’margin-left: 30px;’><li class=’title’><li class=’capaNotesTitle’><div class=’capaDetails’></div><div class=’capaNotes’></div></div>”,
    rowdetailsheight: 350
    },
    initrowdetails: initrowdetails,
    columns: [
    { text: ”, datafield: ‘PriorityImagePath’, width: ‘2%’, cellsrenderer: imagerenderer },
    { text: vIDTitle, dataField: ‘CAPAID’, width: ‘6%’, cellsalign: ‘left’, align: ‘left’ },
    { text: vDescriptionTitle, dataField: ‘ShortCADesc’, width: ‘32%’, cellsalign: ‘left’, align: ‘left’ },
    { text: vDateAddedTitle, dataField: ‘DateAdded’, filtertype: ‘date’, width: ‘12%’, cellsalign: ‘right’, cellsformat: ‘d’ },
    { text: vDueDateTitle, dataField: ‘DueDate’, filtertype: ‘date’, width:’12%’, cellsalign: ‘right’, cellsformat: ‘d’ },
    { text: vResponsibleTitle, dataField: ‘RespPersonShortName’, width: ‘12%’, cellsalign: ‘left’, align: ‘left’ },
    { text: vModuleTitle, dataField: ‘CAModule’, filtertype: ‘list’, filteritems: [vInspection, vIncident, vHazard, vMOC, vRRS, vNCMR, vDiscrete], width: ‘10%’, cellsalign: ‘left’, align: ‘left’ },
    { text: vSiteTitle, dataField: ‘SiteDesc’, width: ‘14%’, cellsalign: ‘left’, align: ‘left’ },
    ],
    handlekeyboardnavigation: function (event) {
    rowindex = $(‘#jqxgrid’).jqxGrid(‘getselectedrowindex’);
    key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0; //ignore jslint
    if (key == 46) {
    $(‘#jqxgrid’).jqxGrid(‘deleterow’, rowindex);
    return true;
    }
    }
    });
    $(‘#saveState’).jqxButton({ height: 25 });
    $(‘#loadState’).jqxButton({ height: 25 });
    $(‘#getState’).jqxButton({ height: 25 });

    var state = null;
    $(“#saveState”).click(function () {
    // save the current state of jqxGrid.
    alert(‘state saved’);
    state = $(“#jqxgrid”).jqxGrid(‘savestate’);
    alert(‘after saved’);
    });
    $(“#loadState”).click(function () {
    // load the Grid’s state.
    if (state) {
    alert(‘loading state 1’);
    $(“#jqxgrid”).jqxGrid(‘loadstate’, state);
    alert(‘loaded’);
    } else {
    alert(‘loading state 2’);
    $(“#jqxgrid”).jqxGrid(‘loadstate’);
    alert(‘loaded 2’);
    }
    alert(‘after’);
    });
    $(“#getState”).on(‘click’, function () {
    var state = $(‘#jqxgrid’).jqxGrid(‘getstate’);
    alert(“Saved Width: ” + state.width + “, Saved Height: ” + state.height + “, pagenum: ” + state.pagenum );
    });

    When I click my savestate button I get both the before and after saved event. When I click the load state, I get the alert alert(‘loading state 1’) but I do not get the 2nd alert. In debugging, I found it is failing on this $(“#jqxgrid”).jqxGrid(‘loadstate’, state);

    The specific error is:
    Unhandled exception at line 7, column 3989 in jpxgrid.storage.js

    JavaScript runtime error: Unable to get property ‘datafield’ of undefined or null reference

    on this piece of code
    {if(D._columns[F].datafield==this.datafield)

    I’ve tried removing all but one column of my grid, setting the autoload and autosave states to true, removing the rowdetails and the initrowdetails. Nothing seems to fix it. The grid is working perfectly otherwise, but I’d like to save the filter and state of the grid and then reload it later.

    Any suggestions on what I may be missing?

    Grid JS error on LoadState #64219

    sjkcwatson
    Participant

    I’m using
    jqwidgets/ v3.4.0 (2014-June-23)

    <script type=”text/javascript” src=”javascript/jquery-1.10.1.js”></script>

    Grid JS error on LoadState #64222

    sjkcwatson
    Participant

    I’ve also tried changing to
    <script type=”text/javascript” src=”javascript/jquery-1.11.1.min.js”></script>
    /jQWidgets_v3_5/

    and still have the same issue.

    Grid JS error on LoadState #64223

    sjkcwatson
    Participant

    In case it is of any help …

    ran again – error thrown here:
    if(F._columns[H].datafield==this.datafield

    With this info:

    > Anonymous function [jqxgrid.storage.js] Line 7 Script
    each [jquery-1.11.1.min.js] Line 2 Script
    _loadselectionandcolumnwidths [jqxgrid.storage.js] Line 7 Script
    loadstate [jqxgrid.storage.js] Line 7 Script
    a.jqx.invoke [jqxcore.js] Line 7 Script
    a.jqx.jqxWidgetProxy [jqxcore.js] Line 7 Script
    Anonymous function [jqxcore.js] Line 7 Script
    each [jquery-1.11.1.min.js] Line 2 Script
    m.prototype.each [jquery-1.11.1.min.js] Line 2 Script
    a.fn[g] [jqxcore.js] Line 7 Script
    Anonymous function [ca_sitemain_open.js] Line 430 Script
    m.event.dispatch [jquery-1.11.1.min.js] Line 3 Script
    r.handle [jquery-1.11.1.min.js] Line 3 Script

    Unhandled exception at line 7, column 3989 in http://localhost/orias/javascript/jQWidgets_v3_5/jqxgrid.storage.js
    0x800a138f – JavaScript runtime error: Unable to get property ‘datafield’ of undefined or null reference
    The thread ‘Win32 Thread’ (0x2ef0) has exited with code 0 (0x0).

    Grid JS error on LoadState #64234

    Dimitar
    Participant

    Hello sjkcwatson,

    Your code seems fine. Could you, please, provide us with a complete example, including some sample data and all your script references? Remember to format your code by selecting it and clicking the code button in the toolbar. Alternatively, you can share a JSFiddle example.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Grid JS error on LoadState #64262

    sjkcwatson
    Participant

    I believe I may have found the issue –

    My datasource has fields that I do not have assigned to columns in the grid (because I reference them in the row details). When it hits datafield #8 which is the first w/out a column, it throws the error. I’ll try testing and putting the remaining fields in hidden columns to see if it solves the problem, but was curious if this is a known issue.

    gridSource = {
        datatype: "json",
        datafields: [
            { name: 'Priority', type: 'integer' },
            { name: 'CAPAID', type: 'string' },
            { name: 'ShortCADesc', type: 'string' },
            { name: 'DueDate', type: 'date' },
            { name: 'DateAdded', type: 'date' },
            { name: 'RespPersonShortName', type: 'string' },
            { name: 'CAModule', type: 'string' },
            { name: 'SiteDesc', type: 'string' },
            { name: 'PriorityImagePath', type: 'string' },
            { name: 'CAPADesc', type: 'string' },
            { name: 'ExtraCADescLine', type: 'string' },
            { name: 'IDTitleTrans', type: 'string' },
            { name: 'LocationTitleTrans', type: 'string' },
            { name: 'ModuleDateTitleTrans', type: 'string' },
            { name: 'ModuleItemTitleTrans', type: 'string' },
            { name: 'ModuleItemNumberStr', type: 'string' },
            { name: 'LocationDesc', type: 'string' },
            { name: 'ModuleItem', type: 'string' },
            { name: 'FModuleItemDate', type: 'string' },
            { name: 'ModuleItem2NumberStr', type: 'string' },
            { name: 'ModuleItem2', type: 'string' },
            { name: 'IsAdmin', type: 'integer' },
            { name: 'AddedByEmpID', type: 'string' },
            { name: 'AddedByEmpName', type: 'string' },
            { name: 'RespPersonEID', type: 'string' },
            { name: 'RespPersonEmail', type: 'string' },
            { name: 'RespPersonName', type: 'string' },
            { name: 'ModuleName', type: 'string' },
            { name: 'NumAffected', type: 'string' },
            { name: 'WhoAffected', type: 'string' },
            { name: 'fDateAdded', type: 'string' },
            { name: 'fDueDate', type: 'string' }
    ],
        cache: false,
        id: 'CAPAID',
        url: url,
        async: false
    };
    
      $("#jqxgrid").jqxGrid({
            theme:  'OriasBlue',
            width: '100%',
            height: 550,
            source: gridDataAdapter,
            sortable: true,
            pageable: true,
            autoheight: true,
            columnsresize: true,
            pagesize: 20,
            pagesizeoptions: ['10', '20', '30','50','100','250','500','1000'],
            pagermode: 'default',
            localization: getLocalization(),
            showfilterrow: true,
            filterable: true,
            altrows: true,
            editable: false,
            enablekeyboarddelete: false,
            showrowdetailscolumn: true,
            selectionmode: 'singlerow',        
            rowdetails: true,
            autoloadstate: false,
            autosavestate: false,
            rowdetailstemplate:
                {
                    rowdetails: "<div style='margin: 10px;'><ul style='margin-left: 30px;'><li class='title'></li><li class='capaNotesTitle'></li></ul><div class='capaDetails'></div><div class='capaNotes'></div></div>",
                    rowdetailsheight: 350
                },
            initrowdetails: initrowdetails,
            columns: [
                { text: '', datafield: 'PriorityImagePath', width: '2%', cellsrenderer: imagerenderer },
                { text: vIDTitle, dataField: 'CAPAID', width: '6%', cellsalign: 'left', align: 'left' },
                { text: vDescriptionTitle, dataField: 'ShortCADesc', width: '32%', cellsalign: 'left', align: 'left' },
                { text: vDateAddedTitle, dataField: 'DateAdded', filtertype: 'date', width: '12%', cellsalign: 'right', cellsformat: 'd' },
                { text: vDueDateTitle, dataField: 'DueDate', filtertype: 'date', width:'12%', cellsalign: 'right', cellsformat: 'd' },
                { text: vResponsibleTitle, dataField: 'RespPersonShortName', width: '12%', cellsalign: 'left', align: 'left' },
                { text: vModuleTitle, dataField: 'CAModule', filtertype: 'list', filteritems: [vInspection, vIncident, vHazard, vMOC, vRRS, vNCMR, vDiscrete], width: '10%', cellsalign: 'left', align: 'left' },
                { text: vSiteTitle, dataField: 'SiteDesc', width: '14%', cellsalign: 'left', align: 'left' },
                ],
            handlekeyboardnavigation: function (event) {
                rowindex = $('#jqxgrid').jqxGrid('getselectedrowindex');
                key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;  //ignore jslint
                if (key == 46) {
                    $('#jqxgrid').jqxGrid('deleterow', rowindex);
                    return true;
                }
            }
        });
    Grid JS error on LoadState #64266

    sjkcwatson
    Participant

    I made columns that are hidden for all the fields – however now it fails on column 32 … when I debug the code (with now 32 columns), it shows the error on column 32 (I’m assuming the first column is 0 since it loops from 0 to H < F.Columns.length. When it launches the debugger, F.Columns.Length=33 and H has a value of 32 when it fails – which makes since because I only have 32 columns which would make 0-31 valid. Before, it was failing on column 8 because I only had 7 columns. I thought maybe it was because I didn’t have all the datafields from my datasource represented in my grid, but I don’t think that is the case. Why is it getting the columns.length as more than the # of columns I have?

        $("#jqxgrid").jqxGrid({
            theme:  'OriasBlue',
            width: '100%',
            height: 550,
            source: gridDataAdapter,
            sortable: true,
            pageable: true,
            autoheight: true,
            columnsresize: true,
            pagesize: 20,
            pagesizeoptions: ['10', '20', '30','50','100','250','500','1000'],
            pagermode: 'default',
            localization: getLocalization(),
            showfilterrow: true,
            filterable: true,
            altrows: true,
            editable: false,
            enablekeyboarddelete: false,
            showrowdetailscolumn: true,
            selectionmode: 'singlerow',        
            rowdetails: true,
            autoloadstate: false,
            autosavestate: false,
            rowdetailstemplate:
                {
                    rowdetails: "<div style='margin: 10px;'><ul style='margin-left: 30px;'><li class='title'></li><li class='capaNotesTitle'></li></ul><div class='capaDetails'></div><div class='capaNotes'></div></div>",
                    rowdetailsheight: 350
                },
            initrowdetails: initrowdetails,
            columns: [
                { text: '', datafield: 'PriorityImagePath', width: '2%', cellsrenderer: imagerenderer },
                { text: vIDTitle, dataField: 'CAPAID', width: '6%', cellsalign: 'left', align: 'left' },       
                { text: vDescriptionTitle, dataField: 'ShortCADesc', width: '32%', cellsalign: 'left', align: 'left' },
                { text: vDateAddedTitle, dataField: 'DateAdded', filtertype: 'date', width: '12%', cellsalign: 'right', cellsformat: 'd' },
                { text: vDueDateTitle, dataField: 'DueDate', filtertype: 'date', width:'12%', cellsalign: 'right', cellsformat: 'd' },
                { text: vResponsibleTitle, dataField: 'RespPersonShortName', width: '12%', cellsalign: 'left', align: 'left' },
                { text: vModuleTitle, dataField: 'CAModule', filtertype: 'list', filteritems: [vInspection, vIncident, vHazard, vMOC, vRRS, vNCMR, vDiscrete], width: '10%', cellsalign: 'left', align: 'left' },
                { text: vSiteTitle, dataField: 'SiteDesc', width: '14%', cellsalign: 'left', align: 'left' },
                { text: '', dataField: 'Priority', width: '0%', cellsalign: 'left', align: 'left',hidden:true},
                { text: '', dataField: 'CAPADesc', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'ExtraCADescLine', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'IDTitleTrans', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'LocationTitleTrans', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'ModuleDateTitleTrans', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'ModuleItemTitleTrans', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'ModuleItemNumberStr', width: '0%', cellsalign: 'left', align: 'left', hidden: true },       
                { text: '', dataField: 'LocationDesc', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'ModuleItem', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'FModuleItemDate', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'ModuleItem2NumberStr', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'ModuleItem2', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'IsAdmin', width: '0%', cellsalign: 'left', align: 'left', hidden: true },        
                { text: '', dataField: 'AddedByEmpID', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'AddedByEmpName', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'RespPersonEID', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'RespPersonEmail', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'RespPersonName', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'ModuleName', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'NumAffected', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'WhoAffected', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'fDateAdded', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
                { text: '', dataField: 'fDueDate', width: '0%', cellsalign: 'left', align: 'left', hidden: true },
            ],
            handlekeyboardnavigation: function (event) {
                rowindex = $('#jqxgrid').jqxGrid('getselectedrowindex');
                key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;  //ignore jslint
                if (key == 46) {
                    $('#jqxgrid').jqxGrid('deleterow', rowindex);
                    return true;
                }
            }
        });

    error from jqxgrid.storage.js

     if (F._columns) {
                                    for (var H = 0; H < F._columns.length; H++) {
                                        if (F._columns[H].datafield == this.datafield) {
                                            if (i.hidden !== undefined) {
                                                F._columns[H]["hidden"] = i.hidden
                                            }
                                            if (i.width !== undefined) {
                                                F._columns[H]["width"] = i.width
                                            }
                                        }
                                    }
                                }

    Unable to get property ‘datafield’ of undefined or null reference

    [Locals]
    this [object(c)]
    arguments [object (Arguments)]
    I 1
    i [object]
    H 32
    [scope] _loadselectionandcolumnwidths
    G [object]
    F [object (b[c])]
    g false
    d []
    n undefined
    y undefined
    Debugger screenshot 1Deubber screenshot 2

    Grid JS error on LoadState #64267

    sjkcwatson
    Participant

    As a further note – if I change

    if (F._columns) {
    for (var H = 0; H < F._columns.length; H++) {

    to

    if (F._columns) {
    for (var H = 0; H < F._columns.length-2; H++) {

    It works perfectly – loading the saving state with no problem. It sure seems like there is something I’m doing to cause this though since it works fine in all your demos, etc and I would like to fix it correctly if possible.

    Grid JS error on LoadState #64269

    sjkcwatson
    Participant

    references

    <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxcore.js"></script>
    <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxmenu.js"></script>
    <link rel="stylesheet" href="javascript/jQWidgets_v3_5/styles/jqx.base.css" type="text/css" />
        <link rel="stylesheet" href="javascript/jQWidgets_v3_5/styles/jqx_oriasmenu.css" type="text/css" />
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxdata.js"></script> 
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxbuttons.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxscrollbar.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxcheckbox.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxgrid.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxgrid.edit.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxgrid.selection.js"></script> 
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxgrid.columnsresize.js"></script> 
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxlistbox.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxdropdownlist.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxdropdownbutton.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxcalendar.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxnumberinput.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxdatetimeinput.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxgrid.sort.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxgrid.filter.js"></script>    
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxgrid.storage.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxgrid.pager.js"></script>
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/localization.js"></script>    
        <script type="text/javascript" src="javascript/jQWidgets_v3_5/jqxtabs.js"></script>

    I did try commenting all these out and use the ‘all.js’ one since that is what is used in fiddler, but same error.

    Grid JS error on LoadState #64300

    Dimitar
    Participant

    Hi sjkcwatson,

    First of all, not all datafields loaded through data adapter have to be assigned to columns in jqxGrid. Clearly, the issue originates elsewhere. Your code seems fine. We would like to test your example. Please provide us with a fiddle we can run directly and reproduce the issue from.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Grid JS error on LoadState #64318

    sjkcwatson
    Participant

    I’m not completely sure how to do that with my data originating from a database. I’ll see if I can figure it out.

    Grid JS error on LoadState #64330

    sjkcwatson
    Participant

    I’m trying to recreate it in fiddle – it was working with the -all.js reference so I’m trying to remove it and add in all the same references I have. However, now it says the dataAdaptor can’t be found, but I have the jqxData.js referenced. Can you see what I am missing and I’ll continue trying to recreate the issue. http://jsfiddle.net/jqwidgets/nyPsV/

    … never mind – it didn’t save it so I have to start over.

    • This reply was modified 9 years, 6 months ago by  sjkcwatson.
    Grid JS error on LoadState #64337

    sjkcwatson
    Participant

    After 4 hours, I give up – when I open JSFiddle with my account to try to create a demo it does not recognize the jqwidgets includes. If I try to add them as external attachments – even uploading them to a website I have so I can reference them that way – I still get an error that it doesn’t recognize $. If I edit the example version there is no way to save and share.

    What version of the widgets and what version of javascript are being used on the example in jsfiddle for grid state and I’ll try to set mine to match exactly? http://jsfiddle.net/jqwidgets/nyPsV/ For some reason _colunns is returning 2 columns more than what is actually in the grid. When it tries to loop through it causes an error as soon as it gets to the index for the columns that don’t actually exist. I don’t know what it is about my grid or the version of files that causes it to think there are more columns than exist. If I subtract 2 from the index loop it works perfectly.

    I’ve commented out all by one column on my grid and nearly all the features and still am getting the same error so something is still off, but since my data is pulling from a webservice and class I need to recreate it as an array or something to upload it for you, but I can’t even recreate the example one you have on a version I can save so I can’t go any further.http://jsfiddle.net/sjkcwatson/8m0qyqrm/

    Grid JS error on LoadState #64363

    Dimitar
    Participant

    Hi sjkcwatson,

    We suggest you fork our example to make sure the references in yours are correct, too.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Grid JS error on LoadState #69313

    wsafa
    Participant

    hi…
    i created function in javascript file,and refernce this file in a view.
    i want to return string from function in javacript file and use this in view when converting it to json object
    function is:
    function configJsonSource(id, async, urlSource, urlAdd, urlUpdate, rowid, rowdata, p1, d1, p2, d2, p3, d3, p4, d4, p5, d5, p6, d6, p7, d7, p8, d8, p9, d9, p10, d10, p11, d11, p12, d12, p13, d13, p14, d14, p15, d15, p16, d16, p16, d16, p17, d17, p18, d18, p19, d19, p20, d20, p21, d21, p22, d22, p23, d23, p24, d24, p25, d25, p26, d26, p27, d27, p28, d28)
    {

    var source = ‘ { dataType: “json”,dataFields: [‘;

    for (i = 7 ; i < arguments.length; i=i+2)
    {

    if (i ==arguments.length-1)
    source = source + ‘{ name: \” + arguments[i] + ‘\’, type: \” + arguments[i + 1] + ‘\’ }’;
    else
    source = source + ‘{ name: \” + String(arguments[i]) + ‘\’, type: \” + arguments[i + 1] + ‘\’ },’;

    }
    source = source.slice(0, source.length – 1);

    source = source + ‘],id: \” + id + ‘\’,async:’ + async + ‘,url:\” + urlSource + ‘\’},’;

    source = source + ‘ addrow: function (rowid, rowdata, position, commit){ $.ajax({url: \” + urlAdd + ‘\’,data:rowdata ,type:”Post”,success: function (data, status, xhr) {$(“#jqxgrid”).jqxGrid(\’updatebounddata\’, \’cells\’);’;

    source=source+’},error:function(jqXHR, textStatus, errorThrown) { alert(“error ajax”);alert(JSON.stringify(errorThrown, null, 3)); commit(false);}});’;

    //
    source = source + ‘},updaterow: function (rowid, rowdata, commit) { $.ajax({ url: \” + urlUpdate + ‘\’, data:rowdata , type:”Post”,’;
    source = source + ‘success: function (data, status, xhr) {$(“#jqxgrid”).jqxGrid(\’updatebounddata\’, \’cells\’);},’;
    source=source+’ error:function(jqXHR, textStatus, errorThrown) { alert(“update row:”); alert(JSON.stringify(errorThrown, null, 3)); commit(false);}});’;

    source = source + ‘}};’;

    return source;

    }

    and in view i used var source = JSON.parse(configJsonSource(id, false, urlSource, urlAdd, urlUpdate, ”, ”, ‘Req_id’, ‘number’, ‘Req_number’, ‘number’, ‘Req_date’, ‘date’, ‘Req_Dep’, ‘number’, ‘DepDesc’, ‘string’, ‘Req_Occasion’, ‘number’, ‘OccDesc’, ‘string’, ‘Req_persons’, ‘number’, ‘Req_Occasion_date’, ‘date’, ‘Req_Items’, ‘string’, ‘Req_price’, ‘double’, ‘Req_Occasion_place’, ‘number’, ‘PlaceDesc’, ‘string’, ‘Req_Evaluation’, ‘string’, ‘EvalDesc’, ‘string’, ‘Req_Note’, ‘string’, ‘flowstatus’, ‘number’, ‘nextflowstep’, ‘number’, ‘nextflowstepDesc’, ‘string’, ‘checkRoleFlowStep’, ‘number’, ‘PreviousFlowstep’, ‘number’, ‘PreviousFlowstepDesc’, ‘string’, ‘CanEdit’, ‘number’, ‘FlowLabel’, ‘string’, ‘cd’, ‘date’, ‘md’, ‘date’, ‘cu’, ‘string’, ‘mu’, ‘string’));

    but it does nt work,ant help?

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.