Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    JS error in ListGrid

    Hi Isomorphic,

    I have an editable ListGrid having double click as edit event. ListGrid.autoSaveEdits is set to false as I need to do bulk save.
    I need to implement following two functionalities.

    1. If user double clicks on any non editable cell in the grid, I want current row to open in edit mode with focus in first editable cell.
    For this I have created a global variable and overridden "cellDoubleClick" and "editorEnter" functions of ListGrid:

    //Create a global variable to hold colNum of cilcked cell
    var cellClick;

    //On double click of a cell set the colNum of cell in variable
    cellDoubleClick: function (record, rowNum, colNum) {
    cellClick = colNum;
    }

    //if its invoked on a non editable cell, open first editable cell in edit mode which is 'bidPrice' in my case.
    editorEnter: function(record, value, rowNum, colNum) {
    if (typeof this.getField(cellClick) != "undefined" && !(this.getField(cellClick)).canEdit) {
    if (this.getFieldNum("bidPrice") != -1) {
    this.endEditing();
    cellClick = -1;
    this.startEditing(rowNum, this.getFieldNum("bidPrice"));
    }
    }
    }

    2. Once user types a value a in editable cell(bidPrice in this case) and hits enter key, I want to do some processing and do not want cursor to move to next row until processing is complete.
    For this I have overridden "editorExit" function of ListGrid and returning false from there. Once processing is completed, I am moving cursor to next row.

    editorExit: function (editCompletionEvent, record, newValue, rowNum, colNum) {
    //Do the processing here via RPC call
    doProcessing(record);
    if (editCompletionEvent == "enter") {
    return false;
    }
    }

    function doProcessing(record) {
    //This will make an RPC request to server via RPCManager and will call function myCallBack once request completes.
    RPCManager.sendRequest({data: record, callback: "myCallBack(data)",actionURL: "someURL"});

    }

    function myCallBack(data){
    //Some code to complete the processing

    //Code to move cursor to next row
    var rowNum = listgrid.getEditRow();
    if (listgrid.getTotalRows() - 1 == rowNum) {
    listgrid.endEditing();
    } else {
    listgrid.startEditing(rowNum + 1, listgrid.getEditCol());
    }
    }

    If I double click on editable cell(bidPrice), this code works fine and cursor moves to next row as well. But if I double click on any non editable cell, I get following JS error and cursor does not move to next row:

    Error: this.form is null
    Source File: http://localhost:8080/eval/isomorphi...sion=7.0rc4.js
    Line: 1205
    if(!_1){if(this.parentItem!=null)_1=this.parentItem.isDisabled();else{_1=this.form.isDisabled();if(!_1&&this.containerWidget!=this.form)_1=this.containerWidget.isDisabled()}}

    Please have a look at it and let me the cause of error. What am I doing wrong here.

    Note that I get this error in FireFox but not in IE. This code works fine in IE.
    Last edited by lchen; 20 Jul 2010, 03:28.

    #2
    If you believe these code snippets are sufficient to replicate the issue, then please create a standalone test case by adding them to a sample.

    Comment

    Working...
    X