Disable rows in an Office UI Fabric React DetailsList
Ok once again I can answer my own question. The Selection object does have a canSelectItem function to check if the user should be able to select certain items. This function should return a bool value and it takes the currently selected item from the array so you can check values easily. I edited my code above with the solution.
I would bind a function to onClick
then preventDefault
or stopPropagation
? Also edit the CSS to remove the cursor
effect to make it looks like a normal HTML tag.
Something like:
if(state === "disabledState"){ let onClickFunc = this.preventClick.bind(this);} else { let onClickFunc = this.normalClick.bind(this);}return <div onClick={onClickFunc}>{defaultRender(props)}</div>