Git Product home page Git Product logo

Comments (6)

ThaDafinser avatar ThaDafinser commented on June 4, 2024

This function currently only works with jqgrid...

I use is also with functions:

$colTypeIcon->setRendererParameter('formatter', 'currencyFmatter ', 'jqGrid');

I extra escape it, because i use common formatter functions:

jQuery.extend($.fn.fmatter , {
    currencyFmatter : function(cellvalue, options, rowdata) {
    return "$"+cellvalue;
}
});
jQuery.extend($.fn.fmatter.currencyFmatter , {
    unformat : function(cellvalue, options) {
    return cellvalue.replace("$","");
}
});

https://github.com/ThaDafinser/ZfcDatagrid/blob/master/src/ZfcDatagrid/Renderer/JqGrid/View/Helper/Columns.php#L149-L151

from zfc-datagrid.

ThaDafinser avatar ThaDafinser commented on June 4, 2024

Can u try it with build in function, custom functions (with extend) and normal custom functions without the escape (see link above)

Then we can change it.

from zfc-datagrid.

ThaDafinser avatar ThaDafinser commented on June 4, 2024

From @webdevilopers on April 30, 2014 14:57

I will be back next week and then try it. Thanks so far!

from zfc-datagrid.

ThaDafinser avatar ThaDafinser commented on June 4, 2024

From @webdevilopers on May 5, 2014 10:40

I started testing. Using the build in function works fine:

$col->setRendererParameter('formatter', "function (value, options, rowObject) { return '<b><u>' + value + '</u></b>'; }");
// or
$col->setRendererParameter('formatter', "function (value, options, rowObject) { return '<b><u>' + value + '</u></b>'; }", 'jqGrid');
// dito
$col->setRendererParameter('formatter', 'function (value, options, rowObject) { return "<b><u>" + value + "</u></b>"; }');
// or
$col->setRendererParameter('formatter', 'function (value, options, rowObject) { return "<b><u>" + value + "</u></b>"; }', 'jqGrid');

custom functions are next.

from zfc-datagrid.

ThaDafinser avatar ThaDafinser commented on June 4, 2024

From @webdevilopers on May 5, 2014 10:48

I tried:

$col->setRendererParameter('formatter', 'formatNumber', 'jqGrid');
#$col->setRendererParameter('formatter', "formatNumber", 'jqGrid');
#$col->setRendererParameter('formatter', 'formatNumber');
#$col->setRendererParameter('formatter', "formatNumber");

The JS generated is always:

{name: "c_number",index: "c_number",label: "Number",width: "5",hidden: false,sortable: true,search: true,formatter: "formatNumber"},

I added each formatter functions standalone using inline and / or headScript:

var formatNumber = function (value, options, rowObject) {
    console.log('formatNumber1');
    return '<b><u>' + value + '</u></b>';
}

jQuery.extend($.fn.fmatter , {
    formatNumber : function(cellvalue, options, rowdata) {
    console.log('formatNumber2');
    return "$"+cellvalue;
}
});

Unfortunately their is no formatting and nothing logged into console.

from zfc-datagrid.

ThaDafinser avatar ThaDafinser commented on June 4, 2024

From @webdevilopers on May 5, 2014 10:53

I commented out the escape line in https://github.com/ThaDafinser/ZfcDatagrid/blob/master/src/ZfcDatagrid/Renderer/JqGrid/View/Helper/Columns.php#L150-L153:

                } elseif ($key == 'formatter') {
                    if (stripos($value, 'formatter') === false && stripos($value, 'function') === false) {
                        #$value = '"' . $value . '"';
                    }

The JS must not be placed via inline script but headscript!

The formatter is now called successfully!

But you have to use the non-extend code:

var formatNumber = function (value, options, rowObject) {
    console.log('formatNumber1');
    return '<b><u>' + value + '</u></b>';
}

Otherwise you get an error:
ReferenceError: formatNumber is not defined

from zfc-datagrid.

Related Issues (20)

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.