Automatically calculate $gridWidth