GithubHelp home page GithubHelp logo

tud / plmexplorer Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 3.0 15.93 MB

applicazione per visualizzazione dati PLM

Home Page: http://www.plmexplorer.com

Ruby 31.16% JavaScript 10.14% HTML 26.15% ApacheConf 2.38% CSS 30.18%

plmexplorer's People

Contributors

gallelli avatar tud avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jagaa

plmexplorer's Issues

Bug+fix

This bug is related to ASP.Net grid output.
Header part (column names) are generated in tBody section in th tags. That leads to situation that tabletogrid creates one empty row.
Suggestion is to:
data.push(row)
and data fill put under if statement:
i if ($('td', $(this)).length != 0) {
data.push(row);
$('td', $(this)).each(function() {
if (rowPos == 0 && selectable) {
var input = $('input', $(this));
var rowId = input.attr("value");
rowIds.push(rowId || data.length);
if (input.attr("checked")) {
rowChecked.push(rowId);
}
row[colModel[rowPos].name] = input.attr("value");
} else {
row[colModel[rowPos].name] = $(this).html();
}
rowPos++;
});
}

Not perfect solution, but it works

tabletogrid upgrade

Hello,
tabletogrid function is great but it misses jqgrid parameters. And setGridParam have no effect on such grids. Update is made that default parameters will not be overwritten. Code bellow makes grid from table + optional parameters:

/*
Transform a table to a jqGrid.
Peter Romianowski [email protected]
If the first column of the table contains checkboxes or
radiobuttons then the jqGrid is made selectable.
*/
// Addition - selector can be a class or id
function tableToGrid(selector, parameters) {
$(selector).each(function() {
if (this.grid) { return; } //Adedd from Tony Tomov
// This is a small "hack" to make the width of the jqGrid 100%
$(this).width("99%");
var w = $(this).width();

    // Text whether we have single or multi select
    var inputCheckbox = $('input[type=checkbox]:first', $(this));
    var inputRadio = $('input[type=radio]:first', $(this));
    var selectMultiple = inputCheckbox.length > 0;
    var selectSingle = !selectMultiple && inputRadio.length > 0;
    var selectable = selectMultiple || selectSingle;
    var inputName = inputCheckbox.attr("name") || inputRadio.attr("name");

    // Build up the columnModel and the data
    var colModel = [];
    var colNames = [];
    $('th', $(this)).each(function() {
        if (colModel.length == 0 && selectable) {
            colModel.push({
                name: '__selection__',
                index: '__selection__',
                width: 0,
                hidden: true
            });
            colNames.push('__selection__');
        } else {
            colModel.push({
                name: $(this).html(),
                index: $(this).html(),
                width: $(this).width() || 150
            });
            colNames.push($(this).html());
        }
    });
    var data = [];
    var rowIds = [];
    var rowChecked = [];
    $('tbody > tr', $(this)).each(function() {
        var row = {};
        var rowPos = 0;
        data.push(row);
        $('td', $(this)).each(function() {
            if (rowPos == 0 && selectable) {
                var input = $('input', $(this));
                var rowId = input.attr("value");
                rowIds.push(rowId || data.length);
                if (input.attr("checked")) {
                    rowChecked.push(rowId);
                }
                row[colModel[rowPos].name] = input.attr("value");
            } else {
                row[colModel[rowPos].name] = $(this).html();
            }
            rowPos++;
        });
    });

    // Clear the original HTML table
    $(this).empty();

    // Mark it as jqGrid
    $(this).addClass("scroll");

    if (parameters == null)
        parameters = {
            datatype: "local",
            width: w,
            colNames: colNames,
            colModel: colModel,
            multiselect: selectMultiple
        };
    else {
        parameters.datatype = "local";
        parameters.width = w;
        parameters.colNames = colNames;
        parameters.colModel = colModel;
        parameters.multiselect = selectMultiple;
    };

    $(this).jqGrid(parameters);

    // Add data
    for (var a = 0; a < data.length; a++) {
        var id = null;
        if (rowIds.length > 0) {
            id = rowIds[a];
            if (id && id.replace) {
                // We have to do this since the value of a checkbox
                // or radio button can be anything 
                id = encodeURIComponent(id).replace(/[.\-%]/g, "_");
            }
        }
        if (id == null) {
            id = a + 1;
        }
        $(this).addRowData(id, data[a]);
    }

    // Set the selection
    for (var a = 0; a < rowChecked.length; a++) {
        $(this).setSelection(rowChecked[a]);
    }
});

};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.