Rank: Member Groups: Member
Joined: 7/29/2008 Posts: 14
|
Hi It would be very nice to implement adding (appending) rows into a grid via JavaScript code. For example, if I have 2 related grid (one for headers and one for lines), the only way to refresh the second grid, when user selects different row in the first grid, is to send callback. This approach is very slow. The second way could be by fetching records with web service method and filling the second grid by deleting and adding rows with JavaScript. I suppose this way could be much faster. I find out there is already deleteItem method but there is no appendItem or addItem method as a part of Grid JavaScript object. Furthermore, I find several similar requests or question in the support forum.
Thanks in advance!
P.S. I apologize because my poor English
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,200
|
Hi, I believe you can add new row that with JavaScript. To use this feature, you would need to: 1. Set the Grid's AllowNewItem to true; 2. Set the Grid's FullRowMode to true; 3. Use the following code to add a new row:
Code: JavaScript
function AddGridItem()
{
//Get the Grid object
var grid = eo_GetObject("Grid1");
//This returns total number of items in the Grid. Note when
//you have AllowNewItem set to true, you will see one more
//item on the screen. For example, when itemCount is 1,
//you will see 2 items on the screen, the last one being the
//the temporary new item
var itemCount = grid.getItemCount();
//Place the new item into edit mode and then exit edit mode
//right away. This will "submit" the new item and make it a
//regular item and also generates a new "new item".
grid.editItem(itemCount, true);
grid.editItem(-1, true);
}
Hope this helps. Thanks
|