Edit Image Value

QuestionsEdit Image Value
Azhar Abdallah asked 8 years ago

Dear Abu,

I'm using the following col condition to view image in grid:

$col["condition"] = array('$row["myImage"] == 0', '', "<a class='image-lightbox' href='javascript:;' containertype='image' data-fancybox-type='iframe' data-fancybox-href='../$imagesDir{myImage}'><img height=40 src='../$imagesDir{myImage}'>");

The field name in database is : "myImage" which contain value like "image001.jpg"

When edit the column i got the following value:
<a class="image-lightbox" href="javascript:;" containertype="image" data-fancybox-type="iframe" data-fancybox-href="../imagesDir/image001.jpg" <src="../imagesDir/image001.jpg" height="40"></a>

How Can I retrieve just the value image001.jpg without the format.

Thank you in advance and Best regards.

2 Answers
Abu Ghufran answered 8 years ago

You can use this unformat code:

$col["unformat"] = "function(cellval,options,cell){ return $('img', cell).attr('src').replace(/^.*[\/]/, ''); }";

It will find img tag, get src, remove path and return file name.
I've not tested it, you can adjust js if required.

Azhar Abdallah answered 8 years ago

Dear Abu Ghufran,

Thank you for your continuous support.

Have a nice day.

Your Answer

14 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?