Click here to Skip to main content
15,847,427 members
Home / Discussions / Web Development
   

Web Development

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