Click here to Skip to main content
16,007,814 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Layout Elements Horizontally Pin
Richard Deeming10-May-17 5:35
mveRichard Deeming10-May-17 5:35 
GeneralRe: Layout Elements Horizontally Pin
Kevin Marois10-May-17 5:40
professionalKevin Marois10-May-17 5:40 
GeneralRe: Layout Elements Horizontally Pin
MikeSpock2-Jun-17 0:38
professionalMikeSpock2-Jun-17 0:38 
QuestionChange WebGrid RowsPerPage During Runtime Pin
Kevin Marois9-May-17 11:43
professionalKevin Marois9-May-17 11:43 
AnswerRe: Change WebGrid RowsPerPage During Runtime Pin
Richard Deeming10-May-17 1:38
mveRichard Deeming10-May-17 1:38 
GeneralRe: Change WebGrid RowsPerPage During Runtime Pin
Kevin Marois10-May-17 6:27
professionalKevin Marois10-May-17 6:27 
JokeRe: Change WebGrid RowsPerPage During Runtime Pin
Richard Deeming10-May-17 7:04
mveRichard Deeming10-May-17 7:04 
QuestionReload WebGrid From Controller Pin
Kevin Marois9-May-17 11:08
professionalKevin Marois9-May-17 11:08 
AnswerRe: Reload WebGrid From Controller Pin
Richard Deeming10-May-17 1:04
mveRichard Deeming10-May-17 1:04 
GeneralRe: Reload WebGrid From Controller Pin
Kevin Marois10-May-17 5:55
professionalKevin Marois10-May-17 5:55 
GeneralRe: Reload WebGrid From Controller Pin
Richard Deeming10-May-17 6:08
mveRichard Deeming10-May-17 6:08 
QuestionWebGrid Searching and Filtering Pin
Kevin Marois8-May-17 8:25
professionalKevin Marois8-May-17 8:25 
SuggestionRe: WebGrid Searching and Filtering Pin
Richard Deeming8-May-17 8:45
mveRichard Deeming8-May-17 8:45 
GeneralRe: WebGrid Searching and Filtering Pin
Kevin Marois8-May-17 10:41
professionalKevin Marois8-May-17 10:41 
QuestionMy website inner pages are not crawling and indexed? Pin
Bharathi Karampudi6-May-17 0:26
Bharathi Karampudi6-May-17 0:26 
AnswerRe: My website inner pages are not crawling and indexed? Pin
Richard Andrew x646-May-17 5:35
professionalRichard Andrew x646-May-17 5:35 
GeneralRe: My website inner pages are not crawling and indexed? Pin
Bharathi Karampudi7-May-17 18:04
Bharathi Karampudi7-May-17 18:04 
QuestionRefresh WebGrid Pin
Kevin Marois2-May-17 11:39
professionalKevin Marois2-May-17 11:39 
I have a page that receives a notification from a SignalR server when either a new row is added to a table or an existing row is changed. The data is displayed in a WebGrid.
proxy.on('notifyAllClientsOfChanges', function (model) {

    // Find the row who's Id matches the model's RowId
    var $row = $(".webgrid-table").find("span[data-row-id='" + model.RowId + "']").closest("tr");

    // If the row was found...
    if ($row.length) {

        // if the row was found, then update it
        updateRow($row, model)
    }
    else {

        // The row does not exist, so add it to the table
        createNewRow(model);
    }

    function createNewRow(model)
    {
        var table = document.getElementById('MyGrid');

        var new_row = table.rows[0].cloneNode(true);

        new_row.cells[0].value = model.RowId;
        new_row.cells[1].value = model.SiteId;
        new_row.cells[2].value = model.InstrumentId;
        new_row.cells[3].value = model.TowerLocation;
        new_row.cells[4].value = model.BayLocation;
        new_row.cells[5].value = model.BaySerialNo;
        new_row.cells[6].value = model.BayStatus;
        new_row.cells[7].value = model.AccessionId;
        new_row.cells[8].value = model.Result;
        new_row.cells[9].value = model.AssayName;
        new_row.cells[10].value = model.Started;
        new_row.cells[11].value = model.Completed;
        new_row.cells[12].value = model.TestSummary;

        table.appendChild(new_row);
    }

    function updpateRow($row, model)
    {
        var col01 = $row.find(".x-SiteId").text(model.SiteId);
        var col02 = $row.find(".x-InstrumentId").text(model.InstrumentId);
        var col03 = $row.find(".x-TowerLocation").text(model.TowerLocation);
        var col04 = $row.find(".x-BayLocation").text(model.BayLocation);
        var col05 = $row.find(".x-BaySerialNo").text(model.BaySerialNo);
        var col06 = $row.find(".x-BayStatus").text(model.BayStatus);
        var col07 = $row.find(".x-AccessionId").text(model.AccessionId);
        var col08 = $row.find(".x-Result").text(model.Result);
        var col09 = $row.find(".x-AssayName").text(model.AssayName);
        var col10 = $row.find(".x-Started").text(model.Started);
        var col11 = $row.find(".x-Completed").text(model.Completed);
        var col12 = $row.find(".x-TestSummary").text(model.TestSummary);
    }
});

The code above fires when a new row is added to the database or changes are made to an existing row. The code does work, but I don't see the additions or updates appear in the grid. If I refresh the page then the controller is called again and the entire data set is returned, which is what I'm trying to avoid.

So, what I want is to see row additions or changes in the WebGrid. How can I refresh the WebGrid without going back to the server?

Thank you
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

SuggestionRe: Refresh WebGrid Pin
Richard Deeming3-May-17 10:52
mveRichard Deeming3-May-17 10:52 
GeneralRe: Refresh WebGrid Pin
Kevin Marois3-May-17 10:54
professionalKevin Marois3-May-17 10:54 
GeneralRe: Refresh WebGrid Pin
Richard Deeming3-May-17 11:03
mveRichard Deeming3-May-17 11:03 
GeneralRe: Refresh WebGrid Pin
Kevin Marois3-May-17 12:31
professionalKevin Marois3-May-17 12:31 
GeneralRe: Refresh WebGrid Pin
Richard Deeming4-May-17 0:47
mveRichard Deeming4-May-17 0:47 
GeneralRe: Refresh WebGrid Pin
Kevin Marois4-May-17 7:11
professionalKevin Marois4-May-17 7:11 
GeneralRe: Refresh WebGrid Pin
Richard Deeming4-May-17 7:32
mveRichard Deeming4-May-17 7:32 

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.