Hello,
litle problem:
Env.: VS 2008 Prof., Net Adv. 9.2
i have a WebDataGrid with a Sql-Datasource. But AutoGenerateColumns="False"; since i only need some colums, and i set them manually in the 'columns'-section (prim-key included).
I want to add a new row in JavaScript without AutoCrud (i must change some cell-values programmatical and then the user can edit the other cells; so i set Autocrud to false). These are the behaviors:
<Behaviors> <ig:RowSelectors RowNumbering="True"> </ig:RowSelectors> <ig:Selection CellClickAction="Row" RowSelectType="Single"> <SelectionClientEvents RowSelectionChanged="wdg_Sel_Changed" /> </ig:Selection> <ig:EditingCore AutoCRUD="False"> <Behaviors> <ig:RowAdding > </ig:RowAdding> </Behaviors> </ig:EditingCore> </Behaviors> <ClientEvents Initialize="wdg_Tabelle_Init" />
Following my js:
if (wdg_obj != null) { // the grid var rows = wdg_obj.get_rows(); // funktioniert nicht! rows.add({ "id": "-1" }); rows.add(["-1", "Point", "Neuer Titel", "Neue Beschreibung", " ", " ", " ", " ", " ", " ", " "]); There are 11 Cells in the row; the row.add return no error; but in the rows collection is no new row added!
What's wrong with my code ??
Missing some behaviors??
Do you handle rowadding on the server and commit the changes to the data base?
After that you need to call DataBind() and the row should appear.
Hello Alex,
no, i call a webservice with client side java-script code, that makes the insert in the database and the same for updating (js + webmethod); only the inital load is handled on the server with a sql-datasource. The return of the call is the new id in the database and with that id, i try to add a new row in the grid; without success.
I only want the grid as a (stupid) place, where the user can filter, sort and modify (via row edit template) the data.
I catch the 'template-closed' event to collect the ID's of the (may be) changed rows in an array and show a save button. On save button click, i select the changed rows (via 'get_rowFromKey([Erg])') and call the web-service for each row to persist the changes.
My problem are the grid and a bing map. The grid holds the point of interest; java script generate the layer and shape for the map with that data and an array to identify the pushpin and the corresponding row in the grid. The user changed the data in the grid but the position on the map. So i catch a map event, transform the position from lat-long to WKT and change the cell value in the connected row.
Question:
Is there a row-dirty proberty, that is set if any cell value of the row is changed ? (at the moment i use wdg_obj.get_behaviors().get_selection().get_selectedRows().getItem(0).get_cell(0).get_value() to collect the selected rows after template closed.
Should i use the ultra web grid? I used it but there were the same problems with row-adding.
And btw. i use a WebImageButton and catch the click on the client. In the event handler, i use
setEnabled(false) function on the 'sender' (the Button) and all works fine. If i later try to enable the button in an other function with
var btn = $get("<%=this.WIB_Save.ClientID %>");
btn.setEnabled(true);
I got an error, that there is no setEnabled-Method. But there is a property and
btn.disabled = false; is working (i can click the button again) but it is greyed out?? What is my fault? Should i handle less in java script (the documentatation of the CSOM is not realy perfect) and more on the server side?
btn.disabled = false; is working (i can click the button again) but it is greyed out??
What is my fault?
Should i handle less in java script (the documentatation of the CSOM is not realy perfect) and more on the server side?