Click here to Skip to main content
15,892,059 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Quick JavaScript Question Pin
Kevin Marois25-Apr-17 7:09
professionalKevin Marois25-Apr-17 7:09 
GeneralRe: Quick JavaScript Question Pin
Kevin Marois25-Apr-17 7:16
professionalKevin Marois25-Apr-17 7:16 
GeneralRe: Quick JavaScript Question Pin
Richard Deeming25-Apr-17 8:10
mveRichard Deeming25-Apr-17 8:10 
GeneralRe: Quick JavaScript Question Pin
Kevin Marois25-Apr-17 8:11
professionalKevin Marois25-Apr-17 8:11 
GeneralRe: Quick JavaScript Question Pin
Richard Deeming25-Apr-17 8:15
mveRichard Deeming25-Apr-17 8:15 
GeneralRe: Quick JavaScript Question Pin
Kevin Marois25-Apr-17 8:19
professionalKevin Marois25-Apr-17 8:19 
QuestionAdd or Update Row In Data Table Pin
Kevin Marois24-Apr-17 12:13
professionalKevin Marois24-Apr-17 12:13 
AnswerRe: Add or Update Row In Data Table Pin
Richard Deeming25-Apr-17 12:48
mveRichard Deeming25-Apr-17 12:48 
You're going to need some way to extract the ID from each row. There doesn't seem to be any way to add custom attributes to the table rows, so you'll need something within a colunm:
grid.Column(columnName: "RowId", header: "Row Id", format: @<text><span data-row-id="@item.RowId">@item.RowId</span></text>),

You should then be able to use jQuery to select the row with the specified ID:
JavaScript
var $row = $(".webgrid-table").find("span[data-row-id='" + model.RowId + "']").closest("tr");
if ($row.length){
    // The row exists:
    $row.find("td").eq(1).text(model.SiteId);
    ...
}
else {
    // The row does not exist:
    $row = createNewRow(model);
    $(".webgrid-table > tbody").append($row);
}

How you create the new row will depend on how complicated your grid is. You could use something like Handlebars.js[^] to create the row based on a template.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Add or Update Row In Data Table Pin
Kevin Marois25-Apr-17 12:49
professionalKevin Marois25-Apr-17 12:49 
GeneralRe: Add or Update Row In Data Table Pin
Kevin Marois26-Apr-17 8:01
professionalKevin Marois26-Apr-17 8:01 
GeneralRe: Add or Update Row In Data Table Pin
Richard Deeming27-Apr-17 1:39
mveRichard Deeming27-Apr-17 1:39 
GeneralRe: Add or Update Row In Data Table Pin
Kevin Marois28-Apr-17 7:21
professionalKevin Marois28-Apr-17 7:21 
GeneralRe: Add or Update Row In Data Table Pin
Richard Deeming28-Apr-17 8:27
mveRichard Deeming28-Apr-17 8:27 
GeneralRe: Add or Update Row In Data Table Pin
Kevin Marois1-May-17 6:55
professionalKevin Marois1-May-17 6:55 
GeneralRe: Add or Update Row In Data Table Pin
Richard Deeming3-May-17 9:51
mveRichard Deeming3-May-17 9:51 
GeneralRe: Add or Update Row In Data Table Pin
Kevin Marois3-May-17 10:35
professionalKevin Marois3-May-17 10:35 
GeneralRe: Add or Update Row In Data Table Pin
Kevin Marois3-May-17 10:37
professionalKevin Marois3-May-17 10:37 
QuestionMSChart load at Runtime raise error NullReferenceException System.Web.UI.DataVisualization.Charting.Axis.Resize Pin
lamiaa_moh23-Apr-17 2:06
lamiaa_moh23-Apr-17 2:06 
AnswerRe: MSChart load at Runtime raise error NullReferenceException System.Web.UI.DataVisualization.Charting.Axis.Resize Pin
Afzaal Ahmad Zeeshan23-Apr-17 2:33
professionalAfzaal Ahmad Zeeshan23-Apr-17 2:33 
Questionapprendre à coder facilement Pin
Member 1312801214-Apr-17 0:51
Member 1312801214-Apr-17 0:51 
AnswerRe: apprendre à coder facilement Pin
User 418025416-Apr-17 16:46
User 418025416-Apr-17 16:46 
Questioncookies not storing in login page why???showing NO cookies found Pin
LOKENDRA YADAV7-Apr-17 20:19
LOKENDRA YADAV7-Apr-17 20:19 
AnswerRe: cookies not storing in login page why???showing NO cookies found Pin
Richard Deeming10-Apr-17 7:41
mveRichard Deeming10-Apr-17 7:41 
QuestionShould i use bootstrap for my project? Pin
Member 131100775-Apr-17 23:37
Member 131100775-Apr-17 23:37 
AnswerRe: Should i use bootstrap for my project? Pin
Richard Deeming6-Apr-17 2:06
mveRichard Deeming6-Apr-17 2:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.