怎么办:元素:this.buildElements(0,20)

时间:2015-08-31 16:47:56

标签: javascript reactjs

您将如何在ES6中执行以下操作:

$("#gridid").jqGrid("filterToolbar", {
    beforeSearch: function () {
        var postData = $(this).jqGrid("getGridParam", "postData");
        if (postData.hasOwnProperty("idmycolumn")) {
            postData.idmysearch = postData.idmycolumn;
            delete postData.idmycolumn;
        }
    }
});

试过这个:

getInitialState: function() {
    return {
        elements: this.buildElements(0, 20),
        isInfiniteLoading: false
    }
},

这只是给出:"未捕获的ReferenceError:元素未定义"

1 个答案:

答案 0 :(得分:1)

loganfsmyth引导我回答。

constructor(props) {
  super(props);
  this.state = { isInfiniteLoading: false , elements: this.buildElements(0, 20)};
}