Create function (Class) Grid with Javascript to handle the partition visualization.