PDA

View Full Version : [CLOSED] Grid Panel Formatting Cells



canusr1
Aug 02, 2013, 3:04 AM
Hello there,

If the data is 0, I would like to show blank in grid panel's cells.

I tried the following code and it's working fine for me.

But because of that Handler changes, colorRenderer() is not working anymore. Can you help me check for that?

Thank you.



<script>
var colorRenderer = function (value, metadata, record, rowIndex, colIndex, store) {

metadata.style = "background-color:#F5F6CE;color:#000000;";

return value;
};
</script>




<ext:Column ID="DAYS" runat="server" Text="No Of Days" DataIndex="DAYS" Width="100">
<Editor>
<ext:TextField ID="txtNoOfDays" runat="server" SelectOnFocus="true"/>
</Editor>
<Renderer Fn="colorRenderer" Handler="if (record.get(this.dataIndex) == 0) {record.data[this.dataIndex] = ''};" />
</ext:Column>

Daniil
Aug 02, 2013, 5:24 AM
Hi @canusr1,

Please edit the post wrapping code in [CODE] tags, see #3:
http://forums.ext.net/showthread.php?10205

canusr1
Aug 02, 2013, 8:09 AM
DONE!!!!!!!!


Hi @canusr1,

Please edit the post wrapping code in [CODE] tags, see #3:
http://forums.ext.net/showthread.php?10205

Daniil
Aug 02, 2013, 8:37 AM
Thank you.

You should not use a Renderer's Fn and Handler at the same time.

So, please move the Hanlder logic into the colorRenderer function.

canusr1
Aug 05, 2013, 6:36 AM
Hello Daniil,

I will appreciate if you can help me how to do combine Hander into to Javascript function?

What I mean is that I have no idea how to get the value of grid row and how to set the value back through Javascript.

Thanks in advance.

Daniil
Aug 05, 2013, 6:38 AM
What about this?


<Renderer Fn="colorRenderer" Handler="if (record.get(this.dataIndex) == 0) {record.data[this.dataIndex] = ''};" />

<script>
var colorRenderer = function (value, metadata, record, rowIndex, colIndex, store) {
metadata.style = "background-color:#F5F6CE;color:#000000;";

if (record.get(this.dataIndex) == 0) {
value = "";
};

return value;
};
</script>

canusr1
Aug 05, 2013, 7:17 AM
var colorRenderer = function (value, metadata, record, rowIndex, colIndex, store) {

metadata.style = "background-color:#F5F6CE;color:#000000;";

if (value == 0) {
value = "";
};

return value;
};


I can use value directly. :D

Thanks so much for the help!!


What about this?


<Renderer Fn="colorRenderer" Handler="if (record.get(this.dataIndex) == 0) {record.data[this.dataIndex] = ''};" />

<script>
var colorRenderer = function (value, metadata, record, rowIndex, colIndex, store) {
metadata.style = "background-color:#F5F6CE;color:#000000;";

if (record.get(this.dataIndex) == 0) {
value = "";
};

return value;
};
</script>