|
Rank: Member Groups: Member
Joined: 6/3/2008 Posts: 26
|
Hi,
1. How can I attach a context menu ( Add,Edit,Delete) to a Grid so that, by right clicking on a row, this menu will appear? 2. Can I display a particular row in edit mode while selecting the Edit option from Context menu? 3. Can I add a new row (Blank row) from client/server side while selecting Add option from Context menu? 4. Can I delete a particular row while selecting Delete option from Context menu?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi, To your questions: 1. That's how context menu is used. Please see documentation for context menu for more details; 2. Yes. Use this function: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.Grid.editItem.html3. You can add a row on the server side, but not on the client side. Simply create a new GridItem and add it to the Grid's Items collection; 4. Yes. Use this function: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.Grid.deleteItem.htmlYou may want to take a look of the document. It explained everything in great details. Thanks
|
|
Rank: Member Groups: Member
Joined: 6/3/2008 Posts: 26
|
Thanks for your reply.
I had gone through the documentation of Context menu. But I can't find any code whcih explains, how the Context menu can be attached to the row of a grid. How I can attache the context menu to the clicked row.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi, I think you attach the menu to the whole Grid instead of a single row. You would just use this function to get the current row when you need to: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.Grid.getSelectedItem.htmlThanks
|
|
Rank: Member Groups: Member
Joined: 6/3/2008 Posts: 26
|
How I can set the contextcontrolid property of the Context menu to the selecteditem of the grid? Whether I have to write javascript for displaying the contextmenu for a selected row in the grid? Which client side event I can utilise for this purpose?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Biju wrote:How I can set the contextcontrolid property of the Context menu to the selecteditem of the grid? You don't. As explained above, The context menu is for the Grid, not for the Grid item. So you set ContextControlID to the ID of the Grid. Who triggers the context menu and who the context menu item operates on are two different things. For example, you right click anywhere on the Grid shows the context menu, but then when you click "Delete" from the context menu, it delete the current selected row. In this case, the Grid triggers the context menu, where "Delete" operates on the current row. The row is the target, but not the trigger. These are two separate issues, you seem to have confused them as one. Currently the Grid does not change current selection when you right click. That might be something we need to address in our future builds. Thanks
|
|
Rank: Member Groups: Member
Joined: 6/3/2008 Posts: 26
|
Thanks for your support Now the context menu will be displayed when i right click anywhere in the grid. Actually, I am trying to Display the context menu only when I right click on a particular row.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Biju wrote:Display the context menu only when I right click on a particular row. That doesn't appear to be possible in the current version. We will look into it and see if we can add that.
|
|
Rank: Member Groups: Member
Joined: 6/3/2008 Posts: 26
|
Thanks for your support. If you found any solution, then please let me know.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi, We have added a new ClientSideOnCntextMenu through which you will be able to display a context menu for a specific item. A new sample is also provided to demonstrate how to use this feature: http://www.essentialobjects.com/Demo/Default.aspx?path=Grid\_i1\_i20Thanks
|
|
Rank: Member Groups: Member
Joined: 6/3/2008 Posts: 26
|
Thanks for your great support.
|
|
Rank: Member Groups: Member
Joined: 6/3/2008 Posts: 26
|
Hi,
I gone through the demo. Now, each item is editable with a single click and it will remain in edit mode even if that cell's focus is changed? 1. How I can display the grid initially as non editable? 2. How I can put a row/cell in non editable mode on its lost focus? 2. How I can use double click instead of single click for displaying a row in edit mode? 3. When I click on the Add New context menu, The grid will put the blank row which is already added to the grid in edit mode. suppose I never added any item in that row and click on some other row. Then one more row will be added to the grid since AllowNewItem is set to True. How I can avoid this kind of adding blank rows? ie, whether any client side event is available when a cell/row has lost it focus so that I can delete the row if that row is blank? 4. In a grid we can set the width either in pixels or as percentage. For aech column, we can set the width in pixels. But How we can set the width of each column by specifying its percentage?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Biju wrote: 1. How I can display the grid initially as non editable? 2. How I can put a row/cell in non editable mode on its lost focus? 3. When I click on the Add New context menu, The grid will put the blank row which is already added to the grid in edit mode. suppose I never added any item in that row and click on some other row. Then one more row will be added to the grid since AllowNewItem is set to True. How I can avoid this kind of adding blank rows? ie, whether any client side event is available when a cell/row has lost it focus so that I can delete the row if that row is blank?
Please see the comment in the context menu sample for more details. The sample should provide information for: 1. How to enter/exit edit mode; 2. How Add New row works in the sample; Biju wrote: 2. How I can use double click instead of single click for displaying a row in edit mode?
You will need to handle ondblclick event and put the Grid into edit mode by yoursef ---- please see answers to your previous questions as to how to put the Grid into edit mode. Biju wrote: 4. In a grid we can set the width either in pixels or as percentage. For aech column, we can set the width in pixels. But How we can set the width of each column by specifying its percentage?
This not possible. You can set one column's Width to -1 to make the column an "AutoFill" column. Thanks
|
|