Add this markup into grid:
<TopBar>
<ext:Toolbar runat="server">
<items>
<ext:Button runat="server" Handler="
var idArray = new Array();
var selection = #{GridEmployees}.getSelectionModel().getSelection();
for(i in selection){
idArray.push(selection[i].data.id);
}
App.direct.DeleteSelected(idArray);" />
</items>
</ext:Toolbar>
</TopBar>
And this code into code behiend:
dataContext ctx = new dataContext(); // your data context
[DirectMethod]
public void DeleteSelected(int[] idArray)
{
ctx.Employees.DeleteAllOnSubmit(
ctx.Employees.Where(x => idArray.Contains(x.id)).ToArray()
);
ctx.SubmitChanges();
}
Or this code:
[DirectMethod]
public void DeleteSelected(int[] idArray)
{
ctx.ExecuteCommand(
string.Format(
"DELETE FROM Employees WHERE ID IN ({0})",
string.Join(",", idArray.Select(x => x.ToString()).ToArray())
)
);
}