Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Setting fieldError with active grouping

$
0
0
Hey guys,

I’m currently trying to implement a listgrid which may group and also can set fieldErrors if needed. While implementing I encountered some problems.

When an error occurs, I’d like to put it to the correlated cell. Here for I search the listgrid for the correlated record and its column number. Afterwards I try to set the field error with listgrid.setFieldError(theColNum, theFieldName, theErrorMessage). And thats the point where the issue occurres.

This works fine if the record in which i want to set the fielderror is visible:


If the record, the field error should be set to, is inside a collapsed group, the method listgrid.getRecordIndex() will answer -1, which indeed makes sense (because it’s not visible). But when needing a correct column number to set a field error, there should be a way to get a correct index or identifier.

Another option would be to call a method which automatically opens all displayed groups or opens the group of a specific record. But this is not implemented.

Furthermore I think, using the record instead of the column number would be much easier in this case. But it seems that this function is not implemented (yet).


Code:

isc.ListGrid.create({
        "ID" : "listGrid",
        "width" : "100%",
        "height" : "100%",
        “canEdit” : true,
        "fields" :
        [{
                        "name" : "uniqueID",
                        "hidden" : true
                }, {
                        "name" : "name"
                }
        ],
        "groupByField" : "name",
        "data" : [{
                        "uniqueID" : 1,
                        "name" : "One"
                }, {
                        "uniqueID" : 2,
                        "name" : "Two"
                }
        ]
});
isc.Button.create({
        "title" : "Set field error",
        "left" : "60px",
        "top" : "120px",
        "action" : function () {
                listGrid.setFieldError(listGrid.getRecordIndex(listGrid.data.find("uniqueID", 2)), "name", "An errorMessage");
        }
})

Best Regards

Viewing all articles
Browse latest Browse all 4756

Trending Articles